Using Visual Studio 2013 Pro:
Here is a little conundrum I have with a web site project (NOT application) that makes use of a NuGet package:
Package A depends on the package Newtonsoft.Json
I install Package A and it in turn installs its dependency: Newtonsoft.Json version 6.0.0
I test my web pages and everything works fine …
In Visual Studio, I do the following:
Tools -> NuGet Package Manager -> Manage NuGet Packages for Solution …
I click on “Updates” and the package manager display an update is available for Newtonsoft.Json (to version 8.0.2)
Naturally, wanting the latest and greatest, I click “Update”
Newtonsoft.Json is downloaded and updated to version 8.0.2
I test my web pages again and behold …
EXCEPTION: System.IO.FileLoadException: Could not load file or assembly 'Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) File name: 'Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed'
So my question is: How to resolve this?…
The only way I been able to is to (so far), is to remove all packages and re-install Package A again as it demands version 6.0.0 of Newtonsoft.Json
BUT, what if I make use of another NuGet package (lets say, Package B) that had a dependency on a different version of Newtonsoft.Json ? In other words, if I make use of any other NuGet package with the same dependency but a different version, an exception will eventually be raised by those pages making use of a package on which a specific dependency version does not exist?
Is there any way around such a scenario – or if I have more than one package that depend on Newtonsoft.Json -- will all packages have to rely on the same version?
Hope I made this clear enough, thanks in advance.