2

I am redirecting a dependent assembly version in app.config and loading dll from a specified location through the following config -

  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="myassembly" culture="neutral" publicKeyToken="ksjdksjdskdjkdjskdjs"/>
        <bindingRedirect oldVersion="1.11" newVersion="1.22"/>
        <codeBase version="1.22" href="file://C:/libs/myassembly.dll"/>
      </dependentAssembly>
    </assemblyBinding>
  </runtime>

In the binding log, it seems like it redirects the version as expected but then compares with the older version and fails:

LOG: Redirect found in application configuration file: 1.11 redirected to 1.22.
LOG: Using codebase from policy file: file:///C:/libs/myassembly.dll.
LOG: Post-policy reference: myassembly, Version=1.22, Culture=neutral, PublicKeyToken=ksjdksjdskdjkdjskdjs
LOG: GAC Lookup was unsuccessful.
LOG: Attempting download of new URL file:///C:/libs/myassembly.dll.
LOG: Assembly download was successful. Attempting setup of file: C:\libs\myassembly.dll
LOG: Entering run-from-source setup phase.
LOG: Assembly Name is: myassembly, Version=1.11, Culture=neutral, PublicKeyToken=ffbc9a05441709bc
WRN: Comparing the assembly name resulted in the mismatch: Minor Version
ERR: The assembly reference did not match the assembly definition found.
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.

I've verified the C:/libs/myassembly.dll is the new version. Can someone please advise what could be the problem here? Much appreciated.

user236215
  • 7,278
  • 23
  • 59
  • 87
  • The binding log says that the loaded assembly version is 1.11. How do you verify that there is new version in the "libs" folder? – Fyodor Soikin Oct 29 '12 at 04:33
  • right clicking C:\libs\myassembly.dll and verifying version attribute. – user236215 Oct 29 '12 at 04:34
  • That may not be enough. There are quite a few different versions in an assembly. Can you open it in Reflector or ILSpy and see what the assembly long name really is? – Fyodor Soikin Oct 29 '12 at 04:40
  • Nice catch. I checked the assembly using ILSpy and it shows it as an older version. How does the version property of a file gets set? As per http://support.microsoft.com/kb/837908, I assumed version of the assembly is set correctly to whatever the real version is when it was compiled. How can this be different? – user236215 Oct 29 '12 at 04:58
  • This is a 3rd party library I am linking against and I don't have control over its versioning. I just want my application to load their assembly from the specified directory. Is it possible to wildcard the version in codeBase tag? – user236215 Oct 29 '12 at 05:13
  • someone please provide some informaton on versioning and why is it different from windows versioning. This could create problems for us – user236215 Oct 29 '12 at 19:47

0 Answers0