Change Dll loaded with MEF

Posted by Tim on Stack Overflow See other posts from Stack Overflow or by Tim
Published on 2011-01-04T15:28:45Z Indexed on 2011/01/04 15:54 UTC
Read the original article Hit count: 152

Filed under:

Hi all,

I'm using MEF and the System.ComponentModel.Composition.dll to load some dll.

I'm doing something like :

AggregateCatalog catalog = new AggregateCatalog(new AssemblyCatalog(Assembly.GetExecutingAssembly()), new DirectoryCatalog(directory));
_container = new CompositionContainer(catalog);
_container.ComposeParts(this);

to import my dll.

After some times, I would like to update my dll but if I try to delete it, I have an access denied, because it's alrealdy used by the program.

How can I release the dll, replace with a new dll and load the dll again ? (without closing the program)

Thanks in advance for your help

© Stack Overflow or respective owner

Related posts about MEF