Thursday, June 27, 2013

ASP.net Web.config use older DLL

I ran into a situation where the web server I was publishing too had an older DLL file than the DLL file I had used to compile on my local server. So when I published to the server it kept looking for the new version rather than just using the one available on the server.
You can specify the version to use in the web.config file. However, it is a bit deceiving when you want to go backwards meaning I want to user version 1.0 but the dll I used to compile was version 2.0. The tag uses the term oldVersion and newVersion. I think most people want to go in the direction from old to new, but in my case it was new to old.
That kept tripping me up. I kept specifying the old and new version thinking it would understand me...no, i had to say the old version is 2.0 and the new version that should be used is 1.0.
Maybe the tags should have been versionToUse and versionToIgnore...
Here is my sample web.config snippet:
  1. <runtime>
  2.         <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
  3.          <dependentAssembly>
  4.          <assemblyIdentity name="DLLname" culture="neutral" publicKeyToken="a7a0b3f5184f2169"/>
  5.          <codeBase version="8.0.0.5" href="FILE://C:/windows/assembly/GAC_MSIL/DLLname"/>
  6.          <bindingRedirect oldVersion="8.1.2.3" newVersion="8.0.0.5" />
  7.          </dependentAssembly>
  8.         </assemblyBinding>
  9.     </runtime>

No comments:

Post a Comment