在bin和gac中的dll,哪一个被使用? [英] Dll in both the bin and the gac, which one gets used?

查看:134
本文介绍了在bin和gac中的dll,哪一个被使用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个Web应用程序部署到许多网站,只有前端更改,共享后端部分在GAC中有它的DLL,所以我们只需要更新一个DLL,所有的网站获得更新。



有没有办法用/ bin文件夹中的DLL覆盖GAC,以便在发布之前测试新功能?

解决方案

如果它与引用的DLL具有相同的版本号,则使用GAC。



如果您增加版本号,请重建引用新版本号的网站,将新版本放在/ bin目录中,然后使用该DLL。 p>

如果你不想更改版本号,你几乎没有运气。



当.NET加载强大的命名程序集时,首先尝试确定要使用的版本号。它首先通过引用执行此操作,然后查找发布商策略,那么它将在配置文件中查找绑定重定向



执行此操作后,它会在GAC中查找程序集,然后在任何 codebase指定,然后它探测DLL的各种文件系统文件夹。如果在任何一个步骤中找到正确的版本汇编,它将停止。



如果您不更改强名称程序集的版本号,.NET将找到原来的一个在GAC停止看。注意,因为它找到一个停止,并且因为查看GAC是第一个,为你的程序集指定一个代码库将不会很好,除非你也指定一个新的版本号。


We have a web application that's deployed to many websites with only frontend changes, the shared backend portion has it's DLL in the GAC so we only have to update that one dll and all the sites get the update.

Is there a way to override the GAC with a DLL in the /bin folder to test out new features before they get released?

解决方案

If it has the same version number as the referenced DLL, the GAC gets used.

If you increment the version number, rebuild the website referencing the new version number, put the new version in the /bin directory, then that DLL will be used.

If you do not want to change the version number, you're pretty much out of luck.

When .NET loads strong named assemblies, first it tries to decide what version number to use. It does this via the reference first, then it looks for publisher policies, then it looks for binding redirects in the configuration file.

After it does this, it looks for the assembly in the GAC, then in any codebase specified, then it probes various file system folders for the DLL. If at any one of those steps it finds the right version assembly, it stops.

If you are not changing the version number of your strong named assembly, .NET will find the original one in the GAC and stop looking. Note that because it stops when it finds one, and because looking in the GAC is first, specifying a codebase for your assembly will do no good unless you also specify a new version number.

这篇关于在bin和gac中的dll,哪一个被使用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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