问题描述
我知道.NET框架在几个位置查找引用的DLL。
- 全局程序集缓存(GAC)
- 添加到AppDomain的任何私有路径
- 执行程序集的当前目录
$ b $这些位置的搜索顺序如何?如果找到一个匹配或者是通过所有位置继续搜索一个DLL,那么搜索是否会被停止(如果是这样,冲突如何解决)?
另外,请确认或否认这些位置,并提供我未能提及的任何其他位置。
相当复杂的过程,这取决于许多不同的因素,如配置文件,发布商策略,应用程序域设置,CLR主机,部分或完整的程序集名称等。
简单版本是GAC是第一个,然后是私有路径。 %PATH%从不使用。
最好使用调试任何装配加载问题。
编辑
更详细地说明了这个过程。
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.
EDIThttp://msdn.microsoft.com/en-us/library/aa720133.aspx explains the process in more detail.
这篇关于搜索哪些位置加载引用的DLL的顺序是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!