.NET程序集具有不同的公共密钥令牌绑定重定向 [英] .Net Assembly Binding Redirect with Differing Public Key Tokens

查看:414
本文介绍了.NET程序集具有不同的公共密钥令牌绑定重定向的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有可能进行组装结合不同版本的引用程序集的重定向如果公钥标记是旧版本无效,并在新版本设置?

例如,我有两个组件...

System.Web.Mvc,版本= 1.0.0.0,文化=中性公钥=空

System.Web.Mvc,版本= 2.0.0.0,文化=中性公钥= 31bf3856ad364e35

应在Asp.Net web.config中的下列程序集绑定重定向工作...

 <运行>
  < assemblyBinding的xmlns =瓮:架构 - 微软COM:asm.v1>
    < dependentAssembly>
      < assemblyIdentity名=System.Web.Mvc公钥=31bf3856ad364e35/>
      < bindingRedirect oldVersion =1.0.0.0NEWVERSION =2.0.0.0/>
    < / dependentAssembly>
  < / assemblyBinding>
< /运行>
 

解决方案

没有,那是不可能的。该组件需要具有相同的公钥

该bindingRedirect标签只有在oldVersion和动态网页属性,所以没有办法告诉它的空的版本呢。

Is it possible to perform an assembly binding redirect between different versions of a referenced assembly if the public key token is null on the older version and set on the newer version?

For example, I have two assemblies...

System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null

and

System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35

Should the following assembly binding redirect work in the Asp.Net web.config...

<runtime>
  <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
    <dependentAssembly>
      <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35"/>
      <bindingRedirect oldVersion="1.0.0.0" newVersion="2.0.0.0"/>
    </dependentAssembly>
  </assemblyBinding>
</runtime>

解决方案

No, it is not possible. The assemblies need to have the same publicKeyToken.

The bindingRedirect tag only has the oldVersion and newVersion attributes, so there's no way to tell it about the "null" version anyway.

这篇关于.NET程序集具有不同的公共密钥令牌绑定重定向的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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