问题
I updated json.net in all projects in my solution and after I get this error:
The type 'Newtonsoft.Json.JsonConvert' exists in both '\packages\Newtonsoft.Json.6.0.1\lib\net45\Newtonsoft.Json.dll' and 'c:\Program Files (x86)\Microsoft Visual Studio 12.0\Blend\Newtonsoft.Json.dll
Why is it trying to load json.net from the Blend folder and how do I get around this issue?
Thanks.
回答1:
In my case, the problem was that there were two references to two different versions of Newtonsoft.Json.dll in my project. This wasn't apparent by looking at the references in the Solution tree view: you have to examine the csproj file.
To fix this:
- right-click the project in Visual Studio, and select Unload Project
- search the MSBuild file for references to Newtonsoft.Json
- delete the reference the older version of the library
- right-click the project and reload it.
回答2:
In my case, I just used the fully qualified name of the assembly:
var obj = Newtonsoft.Json.JsonConvert...
(VS Community 2017 version 15.7.5)
回答3:
In my case I have a duplicated but it was saying version 6 on the error on the project after unloading it and removing all duplicates but the latest solved the problem when I reload it.
Thank you
来源:https://stackoverflow.com/questions/21637424/how-to-resolve-this-conflict-of-two-json-net-existing