使用绑定重定向降级(使用较低版本的库)
我正在使用旧版本的 NHibernate (v3.0.0.1001),并且我坚持使用它,因为新的 LINQ 提供程序破坏了我的很多查询(我稍后会尝试修复)。我想更新使用 NHibernate v3.1.0.4000 的库。
我尝试在 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>
但是当我编译时,我得到:
error CS1705: Assembly 'My3rdPartyDll, Version=0.5.0.170, Culture=neutral, PublicKeyToken=null' using 'NHibernate, Version=3.1.0.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4' 其中有一个版本高于引用的程序集 'NHibernate, Version=3.0.0.1001, Culture=neutral, PublicKeyToken=aa95f207798dfdb4'
是否可以使用绑定重定向来指向降级?
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.
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:
error CS1705: Assembly 'My3rdPartyDll, Version=0.5.0.170, Culture=neutral, PublicKeyToken=null' uses 'NHibernate, Version=3.1.0.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4' which has a higher version than referenced assembly 'NHibernate, Version=3.0.0.1001, Culture=neutral, PublicKeyToken=aa95f207798dfdb4'
Is it possible to use a binding redirect to point to a downgrade?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用
probing
元素指定特定文件夹来查找 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.You can aslo specify a specific assembly to use which is what I think you are looking for.
This Link goes into more details about this.