1
votes

How to redirect Assembly Versions in WPF? Following http://msdn.microsoft.com/en-us/library/7wd6ex19(v=vs.110).aspx#bypass_PP throws File Load exception.

Could not load file or assembly 'Microsoft.Practices.Unity, Version=2.1.505.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

<runtime>
  <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
    <dependentAssembly>
      <assemblyIdentity name="Microsoft.Practices.Unity"
        publicKeyToken="31bf3856ad364e35"
        culture="neutral" />
      <!-- Assembly versions can be redirected in app, 
      publisher policy, or machine configuration files. -->
      <bindingRedirect oldVersion="2.1.505.0" newVersion="3.0.0.0" />
    </dependentAssembly>      
  </assemblyBinding>
</runtime>
1
Can you post the section of your app config where you are doing the redirect? Would help us with trying to figure out your issue.LeftyCoder
@LeftyCoder Thanks. I had 2 configuration tags in config. I am still getting an error. I am editing my question.user2330678
@LeftyCoder Thanks it fixed my problem.user2330678

1 Answers

1
votes
<configuration>  
  <runtime>
      <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
        <dependentAssembly>
          <assemblyIdentity name="Microsoft.Practices.Unity"
            publicKeyToken="31bf3856ad364e35"
            culture="neutral" />
          <!-- Assembly versions can be redirected in app, 
          publisher policy, or machine configuration files. -->
          <bindingRedirect oldVersion="2.1.505.0" newVersion="3.0.0.0" />
        </dependentAssembly>      
      </assemblyBinding>
     </runtime>
</configuration >