old dlls in GAC are still being used

时光总嘲笑我的痴心妄想 提交于 2019-12-24 10:36:29

问题


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?

Edit:

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: 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.

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?

Thanks, Syd


回答1:


The problem you have is, the GAC always wins.

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

Either remove the older dll from your GAC

or

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.



来源:https://stackoverflow.com/questions/8324829/old-dlls-in-gac-are-still-being-used

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!