【发布时间】:2012-04-25 12:39:30
【问题描述】:
如果我使用
Assembly assembly = Assembly.LoadFrom(file);
然后尝试使用该文件,我得到一个异常说明该文件正在使用中。
我需要将它加载到一个新的应用程序域。
我似乎找到的只是如何在 Assembly 中创建实例的示例, 有没有办法加载整个程序集。
我需要的是:
(1) load the assembly into a new AppDomain from a file .
(2) extract an embedded resource (xml file) from the Dll .
(3) extract a type of class which implements an interface (which i know the interface type) .
(4) unload the entire appdomain in order to free the file .
2-4不是问题
我似乎无法找到如何将程序集加载到新的 AppDomin 中,只有示例 create instance ,它为我提供了 Dll 中的类的实例。
我需要整个东西。
喜欢这个问题:Create instance 的另一个例子。
【问题讨论】:
-
也许这个答案对你有帮助? stackoverflow.com/a/225355/747511
标签: c# assemblies appdomain