mscorlib version conflict during build

On a new Win8.1 reinstall, with all of my code restored from backup, I'm suddenly now getting a Visual Studio warning when I build the main project of my solution:

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.

I set the Output log level to Detailed and I found a few entries like this:

There was a conflict between "mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" and "mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes". "mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" was chosen because it had a higher version.

Trouble is, I'm not referencing mscorlib anywhere in the solution—old or new. I have a couple of apps on my machine that require .NET 3.5, but I can't see how that could be related.

One difference: the old Win8.1 install on which this warning did NOT occur was a standalone machine; this time I'm domain-joined. I don't know whether that makes a difference (I can't see how), but I thought I ought to mention it at least.


Having different versions of a Nuget package on different projects may cause this problem as well. Make sure that all your packages have the same version:

  1. (Within Visual Studio) Right click on the solution
  2. Click on Manage Nuget packages for Solution
  3. Click on the Consolidate tab
  4. For every package in the Consolidate tab, update the package to the same version for every project.

I was able to fix this by issuing an update-package -reinstall command at the Package Manager Console.

BUT

Be careful, updating all the packages in your solution could cause other problems, make sure you can roll back to a good version if it goes wrong!


I have been able to fix this issue by deleting my ".suo" file of my solution and then re-opening the solution. I then rebuild the solution and the issue is gone.

The ".suo" file is within the ".vs" folder which is what I usually delete.

Good luck!


I solved this by setting my verbosity to Diagnostic as per this answer.

Once I did that and rebuilt my solution, the build log actually listed the specific packages that depend on the two different versions of mscorlib.

In my particular case, my project had references to version 2.0.20126.16343 of System.Net.Http. I opened up the NuGet Package Manager and updated this package to the latest version (4.3.4 at the time). The next time I built my solution, the warnings were gone.