C# 引用旧dll的另一个程序集

C# 引用旧dll的另一个程序集,c#,assemblies,.net-assembly,C#,Assemblies,.net Assembly,我有两个程序集,让我们称它们为A和B。我给它们指定了强名称,现在问题出现了,程序集B正在寻找程序集A的旧版本。 **EDIT2:如果我删除AssemblyB,问题仍然存在,所以可能只是VS2008在寻找旧版本?同样通过fusionlog,我看到以下警告:wrn应用程序配置文件绑定重定向被禁止。这跟这事有关系吗** 我收到多个相同类型的错误,这里有一个片段: You must add a reference to assembly 'AssemblyA, Version=1.2.4737.2531

我有两个程序集,让我们称它们为A和B。我给它们指定了强名称,现在问题出现了,程序集B正在寻找程序集A的旧版本。 **EDIT2:如果我删除AssemblyB,问题仍然存在,所以可能只是VS2008在寻找旧版本?同样通过fusionlog,我看到以下警告:wrn应用程序配置文件绑定重定向被禁止。这跟这事有关系吗**

我收到多个相同类型的错误,这里有一个片段:

You must add a reference to assembly 'AssemblyA, Version=1.2.4737.25316, Culture=neutral, PublicKeyToken=null'.
项目内的强名称AssemblyA显示以下属性:

在app.config中,我放置了以下代码:

<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>

这里发生了什么?

某些DLL仍然引用了其他DLL的旧版本(名称不明确)。幸运的是,程序集附带了源代码,因此我必须重新编译所有内容,包括密钥

之后,出现了另一个错误,其内容是“定位程序集的清单定义与程序集引用不匹配”

为了解决这个问题,我在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>


如果我在一个没有应用程序的项目上怎么办。config@ShadyM.Najib取决于你在做什么样的项目。您可以尝试通过以下方法添加它:。如果您正在使用SSIS脚本组件,您可以尝试更改此文件:C:\Program Files\Microsoft SQL Server\100\DTS\Binn\DtsDebugHost.exe.config,请将代码段放在标记之间。实际上,我指的是不支持配置文件的项目类型。。适用于eg的Windows 8项目:D@ShadyM.Najib对不起,我帮不了你。你可以试试谷歌,找到这个:。
<?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>