Check the link to the Newtonsoft.json DLL and make sure that it does not automatically select a version outside the package folder in your solution.
My VS 2013 continued to find other copies in various folders /program files (x86)/... He ignored even explicitly adding the package version DLL to the project. I had to dig deeper to find out why this is happening ...
Research
I opened the .csproj project .csproj in text editing mode and searched for all the links to Newtonsoft.Json.
It turned out that I had not one but two links to the DLL in my csproj file (I did not know that this was possible). One of them referred to the older Newtonsoft.json 5.0.6 (the current one was 5.0.8).
Decision
Instead of manually deleting one of them, I added this missing element to the second inclusion of the DLL. I also changed the version number to 5.0.8:
<Private>True</Private>
now it looks like this:
<Reference Include="Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL"> <HintPath>..\..\CsQueryTest\packages\Newtonsoft.Json.5.0.8\lib\net45\Newtonsoft.Json.dll</HintPath> <Private>True</Private> </Reference>
Private is a parameter that defines Copy Local for a DLL reference. Then he turned the DLL back on!
I will figure out what to remove from the csproj file, but for now this may lead to you if you have this problem. It seems like the reason could be a past NUGET update.
source share