另一个引用旧 dll 的程序集 [英] Another assembly referencing the old dll
问题描述
我有 2 个程序集,可以将它们称为 A 和 B.我为它们分配了强名称,现在出现的问题是程序集 B 正在寻找程序集 A 的旧版本.**如果我删除 AssemblyB,问题仍然存在,所以它可能只是 VS2008 寻找旧版本?同样通过fusionlog,我看到以下警告:wrn application configuration file binding redirects disallowed.这与它有什么关系吗?**
I have 2 assemblies lets call them A and B. I've assigned strong names to them and now the problem arises that assembly B is looking for the old version of assembly A. ** If I delete AssemblyB the problem persists so it might just be VS2008 looking for the old version? Also via fusionlog I see the following warning: wrn application configuration file binding redirects disallowed. Does this have anything to do with it? **
我收到多个相同类型的错误,这是一个片段:
I get multiple errors of the same kind, here's one snippet:
You must add a reference to assembly 'AssemblyA, Version=1.2.4737.25316, Culture=neutral, PublicKeyToken=null'.
项目中名为 AssemblyA 的强名称显示以下属性:
The strong named AssemblyA inside the project shows these properties:
在 app.config 中我放置了这段代码:
Inside app.config I've placed this piece of code:
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="AssemblyA" culture="neutral"
publicKeyToken="a22e30ac6a0edfc0"/>
<bindingRedirect oldVersion="1.2.4737.25316" newVersion="1.3.0.19440"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
但这行不通.我可以访问这两个程序集的源代码.
But this does not work. I have access to the source of both assemblies.
如果我删除强命名并将旧的(弱命名)dll 添加到项目中,则会出现错误,询问强命名版本
If I delete the strong named and add the old (weak named) dll to the project it will give an error asking about the strong named version
You must add a reference to assembly 'AssemblyA, Version=1.3.0.19440, Culture=neutral, PublicKeyToken=a22e30ac6a0edfc0'.
这里发生了什么?
推荐答案
某些 DLL 仍然引用其他 DLL 的旧(弱命名)版本.幸运的是,程序集随源一起提供,所以我不得不重新编译包括密钥在内的所有内容.
Some DLL's still referred to the old (weak named) version of other DLL's. Luckily the assemblies came with the source so I had to recompile everything including a key.
在那之后出现了另一个错误,如定位的程序集的清单定义与程序集引用不匹配"
After that another error came up along the lines of "The located assembly's manifest definition does not match the assembly reference"
为了解决这个问题,我在 app.config 中添加了以下内容.
To fix this I added the following in the app.config.
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<publisherPolicy apply="no" />
<assemblyIdentity name="Assemblyname" culture="neutral" publicKeyToken="3a5628535d42dbed"/>
<bindingRedirect oldVersion="1.3.0.15233" newVersion="1.3.0.40647" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
这篇关于另一个引用旧 dll 的程序集的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!