When I clean and then build my solution that has several projects, the output window reports that the build succeeded. However, when I view the Error List Window, it shows me this warning:
Found conflicts between different versions of the same dependent assembly that could not be resolved. These reference conflicts are listed in the build log when log verbosity is set to detailed. C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets
When I double-click this message, it opens the C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets file but I don't understand anything in it.
I am using Visual Studio Express 2013 for the Web.
How do I find out what's wrong and with which DLL and how do I then make the warning go away?
eta: There's a killer article on this stuff by SO's own @Nick Craver that you should read
While the other responses say this, they don't make it explicit, so I will....
On VS2013.2, to actually trigger the emission of the cited information, you need to not read the message, which says:
C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets(1697,5): warning MSB3277: Found conflicts between different versions of the same dependent assembly that could not be resolved. These reference conflicts are listed in the build log when log verbosity is set to detailed.
This is incorrect (or at least it was for some versions of Visual Studio - it seems to be OK on an up to date VS2015 Update 3 or later). Instead turn it to Diagnostic (from Tools->Options->Project and Solutions->Build and Run, set MSBuild project build output verbosity), whereupon you'll see messages such as:
There was a conflict between "Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed" and "Newtonsoft.Json, Version=6.0.5.17707, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed".
- "Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed" was chosen because it was primary and "Newtonsoft.Json, Version=6.0.5.17707, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed" was not.
Then
Ctrl-Alt-O
to go to Build output window...And yes, for those looking at the detail of the [diagnostic] message, it was news to this ignoramus that there's a convention in town whereby all 6.x
versions are, internally Assembly Version 6.0.0.0
, i.e. only the SemVer Major component goes into the Assembly Version :)
Run msbuild Foo.sln /t:Rebuild /v:diag
(from C:\Program Files (x86)\MSBuild\12.0\bin
) to build your solution from command line and get a bit more details, then find the .csproj.
that logs the warning and check its references and references of other projects that use the same common assembly that differs in version.
Edit: You can also set the build verbosity directly in VS2013. Go to Tools
> Options
menu then go to Projects and Solutions
and set MSBuild verbosity to Diagnostic
.
Edit: Few clarifications as I just got one myself. In my case warning was due to me adding a reference using Resharper prompt as opposed to the Add Reference dialog, which did it versionless even though both v4 and v12 are available to choose from.
<Reference Include="Microsoft.Build, Version=12.0.0.0, ..." />
<Reference Include="Microsoft.Build.Framework" />
vs
<Reference Include="Microsoft.Build, Version=12.0.0.0, ..." />
<Reference Include="Microsoft.Build.Framework, Version=12.0.0.0, ..." />
In the MSBuild log with /v:diag
verbosity it looked like the following. giving details which two references conflicted:-
There was a conflict between
"Microsoft.Build.Framework, Version=4.0.0.0, ..." and
"Microsoft.Build.Framework, Version=12.0.0.0, ...". (TaskId:16)
"Microsoft.Build.Framework, Version=4.0.0.0, ..." was chosen because it was primary and
"Microsoft.Build.Framework, Version=12.0.0.0, ..." was not. (TaskId:16)
References which depend on "Microsoft.Build.Framework, Version=4.0.0.0, ..."
[C:\...\v4.5.1\Microsoft.Build.Framework.dll]. (TaskId:16)
C:\...\v4.5.1\Microsoft.Build.Framework.dll (TaskId:16)
Project file item includes which caused reference "C:\...\v4.5.1\Microsoft.Build.Framework.dll". (TaskId:16)
Microsoft.Build.Framework (TaskId:16)
References which depend on "Microsoft.Build.Framework, Version=12.0.0.0, ..."
[C:\...\v12.0\Microsoft.Build.Framework.dll]. (TaskId:16)
C:\...\v12.0\Microsoft.Build.dll (TaskId:16)
Project file item includes which caused reference "C:\...\v12.0\Microsoft.Build.dll". (TaskId:16)
Microsoft.Build, Version=12.0.0.0, ... (TaskId:16)
C:\...\v12.0\Microsoft.Build.Engine.dll (TaskId:16)
Project file item includes which caused reference "C:\...\v12.0\Microsoft.Build.Engine.dll". (TaskId:16)
Microsoft.Build, Version=12.0.0.0, ... (TaskId:16)
C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets(1697,5): warning MSB3277:
Found conflicts between different versions of the same dependent assembly that could not be resolved.
These reference conflicts are listed in the build log when log verbosity is set to detailed.
[C:\Users\Ilya.Kozhevnikov\Dropbox\BuildTree\BuildTree\BuildTree.csproj]
I can only support further Ruben's answer with a comparison between the two messages displayed:
and the message:
C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets(1697,5): warning MSB3277: Found conflicts between different versions of the same dependent assembly that could not be resolved. These reference conflicts are listed in the build log when log verbosity is set to detailed.
So, Ruben's right—this is just not true. There are no conflicts whatsoever, just a missing assembly. This is especially boring when the project is an ASP.NET application, since the views are compiled on demand, that is, just before displayed for the first time. This is when it becomes necessary to have the assembly available. (There's an option to pre-compile the views together with the rest of the code, but this is another story.) On the other hand, if you set the verbosity to Diagnostic you get the following output:
C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets(1697,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "System.Web.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.
As a result, all you need to do is either:
More about NuGet gallery here. More about precompiling ASP.NET views here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With