How to redirect Assembly Versions in wpf?

落花浮王杯 提交于 2019-12-24 06:58:19

问题


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:


<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 >


来源:https://stackoverflow.com/questions/20224538/how-to-redirect-assembly-versions-in-wpf

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!