Patrice Pezillier
Patrice Pezillier

Reputation: 4566

How can I unload a dll in order to delete it after a MEF recomposition?

  1. With MEF, I compose my DLL

  2. I work with my DLL

  3. I recompose without this DLL

  4. I want to delete it // => it doesn't work

How can I unload a dll in order to delete it after a MEF recomposition in which this dll is not composed ?

Upvotes: 1

Views: 1019

Answers (3)

jcvpacheco
jcvpacheco

Reputation: 101

If you try to insert on catalog one Object Assembly like this:

    Assembly assembly = Assembly.Load(System.IO.File.ReadAllBytes(Path.Combine(directoryPath, ItemPlugin)));
aggregateCatalog.Catalogs.Add(new AssemblyCatalog(assembly));

You can Delete the file later...

Upvotes: 0

hammett
hammett

Reputation: 725

Ok so how can I 'connect' an AppDomain to MEF composition ?

MEF doesnt provide infrastructure to do that, unfortunately. You'd have to bake your own.

Upvotes: 0

leppie
leppie

Reputation: 117220

You can not unload a DLL/assembly. Only an AppDomain.

Upvotes: 4

Related Questions