.NET 程序集绑定,我可以将一个程序集映射到另一个程序集中的版本吗? [英] .NET assembly binding, can I map an assembly to a version in another assembly?

查看:36
本文介绍了.NET 程序集绑定,我可以将一个程序集映射到另一个程序集中的版本吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

早上好,是否可以将程序集请求映射到另一个程序集中的版本?例如我们的产品使用 NHibernate 3.2.我们正在转向 NServiceBus 3.2.2.对于 DBSubscription 存储,它使用 NHibernate,并在 NServiceBus.NHibernate 中的 3.3 版 NHibernate 中烘焙.

Good Morning, Is it possible to map assembly requests to the version within another assembly? For instance our product uses NHibernate 3.2. We are moving to NServiceBus 3.2.2. For DBSubscription storage it uses NHibernate and it's baked in version of NHibernate which is 3.3 in NServiceBus.NHibernate.

如何将 NHibernate 3.2.0.2002 的请求映射到 NServiceBus.NHibernate 3.3...

How can I map requests for NHibernate 3.2.0.2002 to NServiceBus.NHibernate which is 3.3...

<assemblyIdentity name="NHibernate"
                          publicKeyToken="aa95f207798dfdb4"
                          culture="neutral" />
        <bindingRedirect oldVersion="3.2.0.2002"
                         newVersion="3.3.0.4000"/> //I need it to be NServiceBus.NHibernate

感谢您提供任何提示或技巧.样品和链接总是受到赞赏.

Thanks for any tips or tricks. Samples and Links are always appreciated.

谢谢大家!

推荐答案

在绑定重定向中,您可以使用 codeBase 元素:

In your binding redirect you can redirect to a different code base using the codeBase element:

<dependentAssembly>
    <assemblyIdentity name="NHibernate" publicKeyToken="aa95f207798dfdb4" culture="neutral" />
    <bindingRedirect oldVersion="3.2.0.2002" newVersion="3.3.0.4000"/>
    <codeBase version="3.3.0.4000" href="file:///C:/path/to/assembly.dll" />
</dependentAssembly>

但是,公钥必须相同.您不能绑定到使用不同密钥签名的不同程序集.

The public keys must be the same, however. You can not bind to a different assembly that is signed with a different key.

如果密钥不同,那么您需要针对 NServiceBus.NHibernate 重新编译您的解决方案.

If the keys are different, then you need to recompile your solution against NServiceBus.NHibernate.

这篇关于.NET 程序集绑定,我可以将一个程序集映射到另一个程序集中的版本吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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