Updating only .dll of a reference in my ASP.NET Application
I have a deploye开发者_Go百科d web application project that references my Utility.dll class library. I want to make a change to the Utlity.dll and roll only that .dll out. The problem is that when I do that, I get the following error when I try to launch my site:
Could not load file or assembly 'Utility, Version=1.0.0.0, Culture=neutral, PublicKeyToken=3766481cef20a9d1' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
Is there a setting I can change so I don't have to roll out the entire web application project - only the Utlity.dll? Thanks!
If the version of your assembly has changed, you -could- force the version back to 1.0.0.0
Though this is not recommended.
Also what assemblies does it reference, and did you update them as well when you updated utility?
Also if the library is signed, and the referencing assembly expects the signed library, you will most likely just have to update the entire project.
Try to modify Assemblies
section in the web.config
file to change an assembly version to required one
There is an "Assemblies" section in "web.config" file in the root of your website. This section stores information about all referenced assemblies and web application loads assemblies according to this file. Every referenced assembly has a record in this section like this one:
<add assembly="Microsoft.mshtml, Version=7.0.3300.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
Try to change Version
attribute of this record (in my example it has value 7.0.3300.0) to the necessary version
I modified the assembly bindings in my web.config file to fix this issue. I used the following examples that were already there:
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.Extensions" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Extensions.Design" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
精彩评论