Home » .Net Framework

VS 2010 project on mapped network drive MEF problem

When developing a MEF application on a mapped network drive I get an FileLoadException when calling:




  Exception Message "Could not load file or assembly 'StandAlone, Version=, Culture=neutral, PublicKeyToken=null' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)" string

I can get the project to work when it is loaded on my local computer. How can I get it to work from the mapped network drive?



2 Answers Found


Answer 1


You're probably running into a code access security issue. You could try to 'whitelist' the network  location using caspol.exe
The following article might help.





Answer 2

I solved that by doing my own file  and directory catalogs:

using System.ComponentModel.Composition.Hosting;
using System.IO;
using System.Linq;
using System.Reflection;

namespace CAD_MEFSupport
	publicclass CAD_AssemblyCatalog : AssemblyCatalog
		public CAD_AssemblyCatalog(FileInfo F)
			: base(Assembly.Load(File.ReadAllBytes(F.FullName)))
			{ }
	publicclass CAD_DirectoryCatalog : AggregateCatalog
		public CAD_DirectoryCatalog(FileInfo[] Files)
			: base(Files.Select(i => new CAD_AssemblyCatalog(i)))
			{ }

Lots of Greetings!




<< Previous      Next >>

Microsoft   |   Windows   |   Visual Studio   |   Sharepoint   |   Azure