Dominic Batstone


Software Development, Process Improvement and Career Progression.

Tags


Dominic Batstone

MSB3277 : Found conflicts between different versions of the same dependent assembly that could not be resolved

29th March 2018

I've been fighting Visual Studio & Nuget this morning which I wrote about earlier today.

Now I'm getting build success (hurrah) but run time error and compiler warnings (boo).

Are you getting?

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.

but cant find the log anywhere, or how to set verbosity to "detailed"?

Firstly, the log is only available to C++ projects according to this MSDN documentation.

So we must setup the Output window to display our diagnostic information. The following screens are from Visual Studio 2015 but will probably work for other versions.

Step 1

Firstly, open the options screen (Tools->Options) and then choose "Diagnostic" in both dropdowns (although as stated above, we won't get a log if not using C++).
Visual Studio Options Screen, Build and Run sub optionClick Ok.

Rebuild your solution.

Step 2

When you rebuild, if the setting change has worked you'll be getting a huge amount of text being added to the output window. You should copy and paste it into notepad and that is your log!

This is a sample from the top of my output window. It has details about my machine and then continues to list huge amount of data about loaded DLLs and the locations it searched.
Some details from the top of my diagnostic output

Step 3 - Resharper Is Overwriting My Settings!

I only got Diagnostic ode to work once before it seemed to revert to Normal verbosity. After pausing for thought, I realised that I was using Resharper Build by default instead of MSBuild. This isn't a bad thing, but Resharper has a habit of overriding Visual Studio settings. I turned off Resharper build and my verbosity returned to "Diagnostic".
Disable resharper build by unchecking the box

Step 4 - Consolidate via NuGet

Click the solution file, then choose "Manage Packages" is a good way to see where some conflicts could be. My MSB3277 errors were caused by packages where obviously the different versions were incompatible. The MSB3277 warning should name the offending assemblies. I consolidated the versions across the solution where appropriate (e.g. consolidate to the correct version and then rebuild).

This image shows that for one of the assemblies, there were 3 different versions installed across multiple projects! I will have to speak to my colleagues about this as there is a problem here, but that is for a different blog post.
consolidate Versions in nuget

Step 5 - Possible web.config issues

The solution I had needed the web.config to be edited slightly. Just to get the site working I commented out the offending redirect.
I commented out the redirect for an offending reference

Culture & Security focussed developer finding ways to increase happiness and efficiency so we can all work easier with better quality code, relationships and lives.

View Comments