简体   繁体   English

Json.net安装不起作用

[英]Json.net installation not working

Simple. 简单。 I installed Json.net using NuGet and when in the code I typed JsonConvert I excepted the auto complete options to kick in, but it didn't. 我使用NuGet安装了Json.net,当在代码中键入JsonConvert时,我加入了自动完成选项,但没有。 I just typed the whole function by my self and got a bunch of errors saying it doesn't exist. 我只是自己输入整个函数,却收到一堆错误消息,说它不存在。 I tried restarting Visual Studio but same results. 我尝试重新启动Visual Studio,但结果相同。 What step am I missing? 我想走哪一步?

You can do this a couple of ways. 您可以通过两种方法进行操作。

Via the "Solution Explorer" 通过“解决方案资源管理器”

Simply right-click the "References" folder and select "Manage NuGet Packages..." Once that window comes up click on the option labeled "Online" in the left most part of the dialog. 只需右键单击“ References”文件夹,然后选择“ Manage NuGet Packages ...”。出现该窗口后,单击对话框最左侧标有“ Online”的选项。 Then in the search bar in the upper right type "json.net" Click "Install" and you're done. 然后在右上角的搜索栏中,键入“ json.net”。单击“安装”,完成。 Via the "Package Manager Console" 通过“包管理器控制台”

Open the console. 打开控制台。 "View" > "Other Windows" > "Package Manager Console" Then type the following: Install-Package Newtonsoft.Json For more info on how to use the "Package Manager Console" check out the nuget docs . 在“视图”>“其他Windows”>“ Package Manager控制台”中输入以下内容:Install-Package Newtonsoft.Json有关如何使用“ Package Manager控制台”的更多信息,请查看nuget docs

我认为您可能忘记了包含以下名称空间:

using Newtonsoft.Json;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM