'Newtonsoft' could not be found
Asked Answered
G

8

31

I pasted the code from http://www.codeproject.com/Tips/789481/Bridging-the-Gap-between-Linqpad-and-Visual-Studio into Visual Studio 15. It tells me that 'Newtonsoft' could not be found. I open the folder "\Microsoft Visual Studio 14.0\Common7\IDE\PrivateAssemblies" and found that the file Newtonsolft.Json.dll is already there. Could anyone tell me how to fixed problem?


enter image description here

Garnett answered 4/11, 2016 at 6:27 Comment(2)
Can u please add a screenshot of your references from Solution Explorer?Belgae
have you added the NuGet package reference? nuget.org/packages/newtonsoft.jsonAdalard
H
42

Solution Explorer->Right Click on Project Name -> Click on Manage Nuget Packages -> Search for newtonsoft -> Click on install button

Hyperplane answered 4/11, 2016 at 7:16 Comment(3)
what if it is already installed and it cannot be uninstalled because it depend on other (to me unknown) .dlls ?Marco
because i though new installation will resolve the problem, i updated the package but iam still getting the same error as askerMarco
Do you have reference added for NewtonSoftJSon.dll in your project?Hyperplane
T
13

Go to Tools -> Library Package Manager -> Package Manager Console

enter image description here

and in the console just write Install-Package Newtonsoft.Json -Version 9.0.1

enter image description here

Talent answered 4/11, 2016 at 6:31 Comment(1)
Works for me! Thanks!Boccherini
R
13

For me I had the package already installed but it was missing the references and it could not be added. Helped me: in NuGet Package Manager to downgrade and upgrade Newtonsoft.Json

Rolle answered 14/12, 2018 at 13:1 Comment(1)
Oh man I wish I had seen this before I wasted a half a day on this. THANK YOU for this answer.Acerb
H
7

You have to get the correct NuGet package. From your link:

enter image description here

You can open the NuGet package manager in: Tools -> Nuget Packet Manager -> Manage Nuget Packages for Solution..

Hotchkiss answered 4/11, 2016 at 6:35 Comment(0)
U
5

I had a similar problem and Google API's had a dependency on Newtonsoft.Json, not allowing me to uninstall Newtonsoft.Json and trying to reinstall.

Removing and and reinstalling Newtonsoft.Json will likely solve the problem, but in my situation, I had to go into Nuget Package Manager -> find Newtonsoft.Json -> select Options dropdown -> check "Force uninstall even if there are dependencies on it".

Checking that box allowed me to remove and subsequently reinstall Newtonsoft and the solution properly referenced it after.

enter image description here

Utham answered 3/7, 2020 at 16:38 Comment(0)
S
2

I had the same problem with visual studio 2019. Simply restarting visual studio fixed the issue. After restarting, the References list in Solution Explorer did show the "Newtonsoft.json".

Silver answered 13/5, 2020 at 0:3 Comment(0)
K
0

Right click on the client project side and select Manage NuGet packages. Then search for Newtonsoft.Json on browse and install. If the class you are trying to use Newtonsoft is in client you must install the package for the client.

Kingship answered 28/11, 2021 at 17:22 Comment(0)
W
0

In case if answers above didn't help you, try to remove the links to Newtonsoft from your .csproj files, for me it helped.

Before this I tried to remove packages folder, tried to remove .nuget cache, remove and install Newtonsoft with --force flag as it is described above but nothing helped for me. Removing from .csproj and reinstalling helped me. I am using VS Community 2022.

Walliw answered 15/2 at 16:6 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.