降级(使用一个版本较低的库)有约束力重定向 [英] Downgrade (use a lower-versioned library) with a binding redirect

查看:233
本文介绍了降级(使用一个版本较低的库)有约束力重定向的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用NHibernate(v3.0.0.1001)的旧版本,我陷进去,因为新的LINQ提供减免了不少我的查询(这是我要努力,以后再修改)。我想更新使用NHibernate的v3.1.0.4000库。

I'm using an older version of NHibernate (v3.0.0.1001) and I'm stuck to it because the new LINQ provider breaks quite a few of my queries (something I'll be trying to fix later). I want to update a library that uses NHibernate v3.1.0.4000.

我已经尝试添加在App.config绑定重定向:

I've tried adding a binding redirect in the App.config:

<?xml version="1.0"?>
<configuration>
    <runtime>
        <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
            <dependentAssembly>
                <assemblyIdentity name="NHibernate" publicKeyToken="aa95f207798dfdb4" culture="neutral"/>
                <bindingRedirect oldVersion="0.0.0.0-3.1.0.4000" newVersion="3.0.0.1001"/>
            </dependentAssembly>
        </assemblyBinding>
    </runtime>
</configuration>

但是,当我编译,我得到:

But when I compile, I get:

错误CS1705:大会'My3rdPartyDll,版本= 0.5.0.170,区域性=中性公钥=空'使用'的NHibernate,版本= 3.1.0.4000,文化=中性公钥= aa95f207798dfdb4'里面有更高版本比引用的程序集NHibernate的,版本= 3.0.0.1001,文化=中性公钥= aa95f207798dfdb4'

是否可以使用绑定重定向指向一个降级?

Is it possible to use a binding redirect to point to a downgrade?

推荐答案

您可以使用探测元素指定一个特定的文件夹中找到该DLL,然后你就可以刚刚过去的DLL到该文件夹​​。

You can use the probing Element to specify a specific folder to find the dll, and then you can just past the dll into that folder.

<runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
        <probing privatePath="Assemblies"/> 
    </assemblyBinding>
</runtime>

您可以ASLO指定特定的组件使用的是什么,我认为你正在寻找。

You can aslo specify a specific assembly to use which is what I think you are looking for.

  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="WorkflowLibrary1" publicKeyToken="8afb6d596a769080" />
        <codeBase version="1.0.0.0" href="Version_1_0_0_0/WorkflowLibrary1.dll"/>
      </dependentAssembly>
    </assemblyBinding>
  </runtime>

这<一个href=\"http://msmvps.com/blogs/theproblemsolver/archive/2008/09/10/versioning-long-running-workfows.aspx\"相对=nofollow>链接进入这个更多的细节。

This Link goes into more details about this.

这篇关于降级(使用一个版本较低的库)有约束力重定向的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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