MSB3277 : Found conflicts between different versions of the same dependent assembly that could not be resolved
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++).
Click 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.
Step 3 1- 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".
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.
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.