如何在应用程序中使用两个dll引用相同dll的不同版本?

时间:2013-10-11 03:25:32

标签: c# .net azure dll

我有一个使用“Windows Azure Storage 2.1.0.2”和“WCF Data Services Client5.6.0”的应用程序。第一个库依赖于Microsoft.Data.OData 5.2.0,第二个库依赖于Microsoft.Data.OData 5.6。我如何让它运作?

1 个答案:

答案 0 :(得分:3)

您可以使用AssemblyBinding重定向将旧版本重定向到较新版本。有关同一问题,请参阅Could not load file or assembly Microsoft.Data.OData Version=5.2.0.0 error in Azure Cloud Worker Role using Table Storage

这是简短的回答:

 <runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
  <dependentAssembly>
    <assemblyIdentity name="Microsoft.Data.OData" publicKeyToken="31bf3856ad364e35" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-5.6.0.0" newVersion="5.6.0.0" />
  </dependentAssembly>
  <dependentAssembly>
    <assemblyIdentity name="Microsoft.Data.Edm" publicKeyToken="31bf3856ad364e35" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-5.6.0.0" newVersion="5.6.0.0" />
  </dependentAssembly>
</assemblyBinding>