[英]Loading an assembly with dependencies to other assemblies within its directory which is outside the loading applications directory?
我有一个应用程序,说在C:\\ app中运行并在运行时从C:\\ bin \\ assembly1.dll加载程序集,'assembly1.dll'依赖于'assembly2.dll'和'assembly3.dll'两者都它位于C:\\ bin,有没有办法确保C:\\ bin \\ assembly1.dll可以在同一目录中加载它的两个依赖项?
It depends on how c:\\bin\\assembly1.dll
is loaded. 这取决于如何加载
c:\\bin\\assembly1.dll
。 If you are using the Assembly.LoadFrom
method then that should be enough. 如果您使用的是
Assembly.LoadFrom
方法,那就足够了。 The LoadFrom
method will add the directory targeted to the hints list of the loader. LoadFrom
方法将目标目录添加到加载程序的提示列表中。 From then on it will probe that directory for resolving DLL dependencies. 从那时起,它将探测该目录以解决DLL依赖关系。
The process for assembly loading and dependency probing is quite complex. 装配加载和依赖性探测的过程非常复杂。 There is a rather large tutorial on MSDN which covers the details.
MSDN上有一个相当大的教程,涵盖了细节。 Section 4 is probably of most interest to you
第4部分可能是您最感兴趣的
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.