Another assembly referencing the old dll

≡放荡痞女 提交于 2019-12-24 04:54:09

问题


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. **EDIT2: 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'.

The strong named AssemblyA inside the project shows these properties:

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.

EDIT: 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'.

What's happening here?


回答1:


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"

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>


来源:https://stackoverflow.com/questions/15679577/another-assembly-referencing-the-old-dll

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!