简体   繁体   English

将具有依赖项的程序集加载到其目录中位于加载应用程序目录之外的其他程序集中?

[英]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.

相关问题 加载程序集及其依赖项 - Loading assemblies and its dependencies C#:如何在动态加载的程序集中更改搜索目录以查找动态加载的程序集的依存关系? - C#: How to change search directory for dependencies of dynamically loaded assemblies within a dynamically loaded assembly? 动态加载需要GAC程序集的组件,而该程序集实际上是不可用的? - Dynamically loading an assembly which expects GAC assemblies which are not actually available? 以编程方式加载程序集及其依赖项时的奇怪行为 - Strange behavior when loading assemblies and its dependencies programatically 运行时在C#应用程序中加载程序集不存在于应用程序工作目录中 - Loading Assemblies in c# application at runtime not present in application working directory 如何从自定义目录动态加载程序集,包括其依赖项? - How to dynamically load an assembly from custom directory including its dependencies? 在AppDomain中加载具有依赖项的程序集的麻烦 - Loading assembly with dependencies in AppDomain trouble 加载 .NET 程序集依赖项不起作用 - Loading .NET assembly dependencies not working 加载程序集时依赖项冲突 - Conflicting dependencies when loading an assembly 将C#DLL加载到C ++ / CLI-依赖目录 - Loading C# DLL to C++/CLI - dependencies directory
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM