Brad C
Brad C

Reputation: 2982

VS2012 NuGet update causing cryptic warnings on build

The recent Visual Studio 2012 update seems to have broke something in my build. I think it has to do with last week's nuget update.

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 ==========

How could I resolve these warnings? I've had all kinda of weird side effects in my application since they have appeared such as: inconsistent model binding (related to the Edm assembly?).

Upvotes: 1

Views: 1593

Answers (2)

Yves Tkaczyk
Yves Tkaczyk

Reputation: 531

As the message indicates you can fix these warning by mapping the assembly version 5.2 to version 5.6. You do this by editing the assemblyBinding of your config file. In this case, add the following 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>

Upvotes: 4

Erik Funkenbusch
Erik Funkenbusch

Reputation: 93474

I'm not sure why you think this is cryptic, it's quite clear. You have more than one version of those packages installed (5.2 and 5.6) Some of your components are referencing 5.2 and some 5.6, and this is causing the warning. It's suggesting that you alias 5.2 to 5.6 so that the assemblies referencing 5.2 will use 5.6 instead.

This is probably no the best approach though, unless you have no control over those assemblies. You should probably just uninstall the 5.2 packages, and then update the nuget references to the 5.6 version and rebuild.

Upvotes: 2

Related Questions