Home » .Net FrameworkRSS

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:

catalog.Catalogs.Add(

 

newDirectoryCatalog(@".\InterfaceImplementations\"));

  Exception Message "Could not load file or assembly 'StandAlone, Version=1.0.0.0, 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

Hi,

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.

http://blogs.msdn.com/b/shawnfa/archive/2004/12/30/344554.aspx

Regards,

Martin

 

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!

Volker

 
 
 

<< Previous      Next >>


Microsoft   |   Windows   |   Visual Studio   |   Follow us on Twitter