开发者

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 ?


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


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.


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...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜