assembly binding error in C#

979 views Asked by At

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.

0

There are 0 answers