如何在 wpf 中重定向程序集版本? [英] How to redirect Assembly Versions in wpf?

查看:26
本文介绍了如何在 wpf 中重定向程序集版本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在 WPF 中重定向程序集版本?关注 http://msdn.microsoft.com/en-us/library/7wd6ex19(v=vs.110).aspx#bypass_PP 抛出文件加载异常.

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.

无法加载文件或程序集Microsoft.Practices.Unity, Version=2.1.505.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"或其依赖项之一.定位的程序集的清单定义与程序集引用不匹配.(来自 HRESULT 的异常:0x80131040)

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>

推荐答案

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

这篇关于如何在 wpf 中重定向程序集版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆