1

If I am provided with a 3rd party dll, say version 1.1

then I build a dll of my own referencing this 3rd party dll (version 1.1)

now I supply my dll back to this 3rd party. my dll has been built using they 1.1 "api" dll.

Now the 3rd party changes the version of their dll, which is also used within their software to version 1.2

After this, their software can no longer use my dll compiled with version 1.1 until I recompile my plugin dll with their version 1.2 dll.

How can this problem be resolved?

4

1 回答 1

0

引用您所依赖的较新版本的程序集的程序集的使用者应在其应用程序配置文件中使用该<bindingRedirect>元素,如下所示:

<configuration>
   <runtime>
      <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
         <dependentAssembly>
            <assemblyIdentity name="myDependency"
                              publicKeyToken="32ab4ba45e0a69a1"
                              culture="neutral" />
            <bindingRedirect oldVersion="1.0.0.0"
                             newVersion="2.0.0.0"/>
         </dependentAssembly>
      </assemblyBinding>
   </runtime>
</configuration>

请注意,这myDepdendency是您所依赖的已升级程序集的名称。

这在 Entity Framework 和 ASP.NET MVC 中常用;通过 NuGet 添加它们通常会导致将上述部分添加到您的应用程序配置文件中。

于 2012-10-26T17:56:15.757 回答