JSON.NET How To Reference?

2019-02-05 15:30发布

问题:

I just installed the Json.Net package and now I am wondering how I can import this to my project? I first tried "using Newtonsoft.Json;" but that's not coming up. I tried looking for it by adding a reference to my project first but I can't find it the list either? I also can't seem to find anyone else with this problem or any directions doing a few quick Google searches. Please tell me how easy this is to do...

回答1:

right click on your project and select "manage nuget package". put json into the search, find it in the list and click "install"



回答2:

If you are doing this manually, right click on the "Reference" folder in your project's solution tree. Choose "Add Reference" -> "Browse" tab, locate Newtonsoft.Json.dll on your computer(You have to download this from the internet first) and add it as a reference to your project.

If you are using NuGet, right click on the "Reference" folder in your project's solution tree and choose "Manage NuGet Packages", pick the "Online" tab, search for Json.Net and click "install".



回答3:

Right click on your project in solution explorer and select "manage nuget packages", then click Online in the navigation bar, type newtonsoft into the search bar, find it in the list and click "install"



回答4:

Check to see if the Json.net is already install in your project.

If it is already installed go and remove the "package" entry from "packages.config" file. Now go to NuGet "Package Manager Console" and install the new package using the following command:

PM> Install-Package Newtonsoft.Json {Your Project Name} 6.0.3 nuget.org

If it is not installed, go to NuGet and search for JSon.Net and select the project and click install.