VS2012 NuGet更新导致构建时出现神秘警告

时间:2013-09-03 21:01:29

标签: asp.net-mvc-4 visual-studio-2012 nuget

最近的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程序集相关?)。

2 个答案:

答案 0 :(得分: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>

答案 1 :(得分:2)

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

这可能不是最佳方法,除非您无法控制这些程序集。您可能只需卸载5.2软件包,然后将nuget引用更新为5.6版本并重建。