简体   繁体   中英

How to get .NET to look for assemblies in local folders first instead of GAC?

It is my understanding that .NET runtime will always look for referenced assemblies in GAC first and then in the local folders. Is there a setting in Web.Config that would invert this order?

No. It's not possible to achieve this. If a DLL of equal version to the one referenced in your program exists in the GAC the CLR will always choose this one. There is no way to override this behavior.

More info. on work arounds in this SO thread .

我不确定是否会有一些实际上会反转搜索顺序的内容,但是根据您的要求,您可能需要查看程序集绑定重定向 ,这可以让您对加载哪些版本的程序集进行大量控制。

JaredPar is right - the GAC will always get polled first for the assembly. However, if you're like me, and want to have the DLL live in the GAC and still debug, you can add a build script to dump your .pdb file the same folder as the assembly in the GAC (it'll be in C:\\windows\\assembly\\gac_msil\\assembly.name_[public key token]).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM