1

最近的 Visual Studio 2012 更新似乎破坏了我的构建。我认为这与上周的 nuget 更新有关。

NuGet package restore started.
All packages are already installed and there is nothing to restore.
NuGet package restore finished.
1>------ Rebuild All started: Project: Project1, Configuration: Debug Any CPU ------
1>  Consider app.config remapping of assembly "Microsoft.Data.OData, Culture=neutral, PublicKeyToken=31bf3856ad364e35" from Version "5.2.0.0" [] to Version "5.6.0.0" [C:\Users\avianbc\Desktop\Project1\packages\Microsoft.Data.OData.5.6.0\lib\net40\Microsoft.Data.OData.dll] to solve conflict and get rid of warning.
1>  Consider app.config remapping of assembly "Microsoft.Data.Edm, Culture=neutral, PublicKeyToken=31bf3856ad364e35" from Version "5.2.0.0" [] to Version "5.6.0.0" [C:\Users\avianbc\Desktop\Project1\packages\Microsoft.Data.Edm.5.6.0\lib\net40\Microsoft.Data.Edm.dll] to solve conflict and get rid of warning.
1>  Consider app.config remapping of assembly "System.Spatial, Culture=neutral, PublicKeyToken=31bf3856ad364e35" from Version "5.2.0.0" [] to Version "5.6.0.0" [C:\Users\avianbc\Desktop\Project1\packages\System.Spatial.5.6.0\lib\net40\System.Spatial.dll] to solve conflict and get rid of warning.
1>c:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1605,5): warning MSB3247: Found conflicts between different versions of the same dependent assembly.
1>  Project1 -> C:\Users\avianbc\Desktop\Project1\Project1\bin\Project1.dll
========== Rebuild All: 1 succeeded, 0 failed, 0 skipped ==========

我该如何解决这些警告?自从它们出现以来,我的应用程序中出现了各种奇怪的副作用,例如:不一致的模型绑定(与 Edm 程序集有关?)。

4

2 回答 2

4

正如消息所示,您可以通过将程序集版本 5.2 映射到版本 5.6 来修复这些警告。您可以通过编辑配置文件的 assemblyBinding 来做到这一点。在这种情况下,添加以下 XML:

<dependentAssembly>
    <assemblyIdentity name="Microsoft.Data.OData" publicKeyToken="31bf3856ad364e35" />
    <bindingRedirect oldVersion="0.0.0.0-5.2.0.0" newVersion="5.6.0.0" />
</dependentAssembly>
<dependentAssembly>
    <assemblyIdentity name="Microsoft.Data.Edm" publicKeyToken="31bf3856ad364e35" />
    <bindingRedirect oldVersion="0.0.0.0-5.2.0.0" newVersion="5.6.0.0" />
</dependentAssembly>
<dependentAssembly>
    <assemblyIdentity name="System.Spatial" publicKeyToken="31bf3856ad364e35" />
    <bindingRedirect oldVersion="0.0.0.0-5.2.0.0" newVersion="5.6.0.0" />
</dependentAssembly>
于 2013-09-05T18:04:02.320 回答
2

我不确定你为什么认为这很神秘,这很清楚。您安装了多个版本的这些软件包(5.2 和 5.6) 您的一些组件引用了 5.2 和一些 5.6,这导致了警告。它建议您将 5.2 别名为 5.6,以便引用 5.2 的程序集将使用 5.6。

不过,这可能不是最好的方法,除非您无法控制这些程序集。您可能应该只卸载 5.2 包,然后将 nuget 引用更新到 5.6 版本并重建。

于 2013-09-04T01:40:03.440 回答