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

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

问题描述

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




  • 全局程序集缓存(GAC)

  • 添加到AppDomain的任何私有路径

  • 执行程序集的当前目录


$ b $这些位置的搜索顺序如何?如果找到一个匹配或者是通过所有位置继续搜索一个DLL,那么搜索是否会被停止(如果是这样,冲突如何解决)?



另外,请确认或否认这些位置,并提供我未能提及的任何其他位置。

解决方案

相当复杂的过程,这取决于许多不同的因素,如配置文件,发布商策略,应用程序域设置,CLR主机,部分或完整的程序集名称等。



简单版本是GAC是第一个,然后是私有路径。 %PATH%从不使用。



最好使用装配绑定日志查看器(Fuslogvw.exe)调试任何装配加载问题。



编辑
http://msdn.microsoft.com/en-us/library/ aa720133.aspx 更详细地说明了这个过程。


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

  • Global assembly cache (GAC)
  • Any private paths added to the AppDomain
  • The current directory of the executing assembly

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)?

Also, please confirm or deny those locations and provide any other locations I have failed to mention.

解决方案

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.

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

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

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

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

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