GAC中的旧dll仍在使用 [英] old dlls in GAC are still being used

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

问题描述

我有一个设置,在每次构建后将程序集发布到GAC.但是我的应用程序一直都在使用旧的dll.生成后,将在新文件夹中创建新的dll.文件夹名称为7.1.7573.0_ d516cb311和7.1.5000.8888 _d516cb311.第二个文件夹是最新的.从文件夹名称看来,我当前的代码正在发布旧的dll.这是我的应用程序使用旧dll的原因吗?如果是,我该怎么做才能发布当前汇编?

I have a set up where the assembly is published to the GAC after each build. But My application uses the old dll all the time. After build the new dlls are created in a new folder. The folder names are 7.1.7573.0_d516cb311 and 7.1.5000.8888_d516cb311. The second folder being the latest. It seems(from the folder name) my current code is publishing old dll. Is it the reason my application is using old dll? If yes What will I have to do so that currect assembly is published?

在web.config文件中,程序集已在运行时元素下注册.它的版本是Version.7.0.0.0.

In the web.config file the assembly is registered under runtime element. And its version is the Version is 7.0.0.0.

<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<qualifyAssembly partialName="dllpartialname" fullName="dllfullname,version=7.0.0.0,publicKeyToken=d516cb311,culture=neutral"/>
</runtime>
</assemblyBinding>

Edit2: 现在我知道问题出在哪里.我的Web项目正在引用一个版本为7.1.7573.0的程序集.但是(我的类库的)assemblyinfo.cs文件中的assemblyversion是7.1.5000.8888.当我构建类库项目时,它会将具有7.1.5000.8888版本(即assemblyinfo.cs文件中的assemblyversion)的程序集发布到GAC.但是由于我的Web项目正在参考7.1.7573.0. ,它仍然使用7.1.7573.0_d516cb311文件夹中的dll,而忽略其他文件夹.

Now I know What the problem is. My web project is referencing an assembly which has a version 7.1.7573.0. But the assemblyversion in the assemblyinfo.cs file (of my classlibrary) is 7.1.5000.8888. When I am building the class library project, It is publishing an assembly having a version 7.1.5000.8888(i.e. the assemblyversion in assemblyinfo.cs file) to the GAC. But as my web project is having a reference to 7.1.7573.0. , It still uses the dll in the folder 7.1.7573.0_d516cb311 and ignores the other folder.

现在面临另一个问题.我在assemblyinfo.cs文件中更新了assemlyversion.但是,当我尝试构建它时,更改会自动恢复.它说此文件已在源代码编辑器外部修改.为什么会这样呢?有人知道吗?

Edit 3: Facing a different problem now. I updated the assemlyversion in the assemblyinfo.cs file. But when I try to build it it changes are reverted automatically. It says this file has been modified outside the source editor. Why is this happening ? Does anyone have an idea about it?

谢谢, Syd

推荐答案

您遇到的问题是,GAC总是赢.

The problem you have is, the GAC always wins.

当您引用一个dll时,即使您引用了另一个本地dll,GAC中的版本也将获胜.

When you reference a dll, even if you reference a different local dll, the version in GAC will win.

从GAC中删除较旧的dll

Either remove the older dll from your GAC

添加对新的dll本地版本的新引用,并更改配置行以匹配新dll的版本号.

Add a new reference to your new local version of the dll and change the config line to match the version number of your new dll.

版本号可以在文件的属性中找到.

The version number can be found in the properties of the file.

这篇关于GAC中的旧dll仍在使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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