以什么顺序搜索位置以加载引用的 DLL? [英] In what order are locations searched to load referenced DLLs?

查看:14
本文介绍了以什么顺序搜索位置以加载引用的 DLL?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道 .NET 框架会在多个位置查找引用的 DLL

I know that the .NET framework looks for referenced DLLs in several locations

  • 全局程序集缓存 (GAC)
  • 添加到 AppDomain 的任何私有路径
  • 执行程序集的当前目录

这些位置的搜索顺序是什么?如果找到匹配项,对 DLL 的搜索是停止还是继续搜索所有位置(如果是,如何解决冲突)?

What order are those locations searched? Is the search for a DLL ceased if a match is found or does it continue through all locations (and if so, how are conflicts resolved)?

另外,请确认或否认这些地点,并提供我未提及的任何其他地点.

推荐答案

程序集加载是一个相当复杂的过程,它取决于许多不同的因素,例如配置文件、发布者策略、应用程序域设置、CLR 主机、部分或完整程序集名称、等

Assembly loading is a rather elaborate process which depends on lots of different factors like configuration files, publisher policies, appdomain settings, CLR hosts, partial or full assembly names, etc.

简单的版本是首先是 GAC,然后是私有路径.%PATH% 从未使用过.

The simple version is that the GAC is first, then the private paths. %PATH% is never used.

最好使用 汇编绑定日志查看器 (Fuslogvw.exe) 以调试任何程序集加载问题.

It is best to use Assembly Binding Log Viewer (Fuslogvw.exe) to debug any assembly loading problems.

编辑http://msdn.microsoft.com/en-us/library/aa720133.aspx 更详细地解释了该过程.

EDIT http://msdn.microsoft.com/en-us/library/aa720133.aspx explains the process in more detail.

这篇关于以什么顺序搜索位置以加载引用的 DLL?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆