Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 在Ubuntu上安装newtonsoft json for.NET_C#_.net_Linux_Ubuntu 16.04 - Fatal编程技术网

C# 在Ubuntu上安装newtonsoft json for.NET

C# 在Ubuntu上安装newtonsoft json for.NET,c#,.net,linux,ubuntu-16.04,C#,.net,Linux,Ubuntu 16.04,我只是想解析一些JSON,这些JSON是我从C#中的API调用中得到的。我在Ubuntu上使用.NET。为了实现这一点,我尝试使用 nuget install Newtonsoft.Json 库安装成功。然而,当我运行程序时,我得到以下错误: error CS0246: The type or namespace name 'Newtonsoft' could not be found (are you missing a using directive or an assembly refe

我只是想解析一些JSON,这些JSON是我从C#中的API调用中得到的。我在Ubuntu上使用.NET。为了实现这一点,我尝试使用

nuget install Newtonsoft.Json
库安装成功。然而,当我运行程序时,我得到以下错误:

error CS0246: The type or namespace name 'Newtonsoft' could not be found (are you missing a using directive or an assembly reference?)
这是怎么回事?如何让.NET识别新图书馆


另外,我并不特别喜欢这个库,我只想在Ubuntu上解析.NET中的frikin JSON字符串。还有其他想法吗?

此dll在Mono gac中提供。您需要添加新的引用,否则会收到错误消息。如果您使用的是corefx,则使用dotnet restore。将加载该包。
我终于明白了!我只需手动修改package.json文件,然后键入
dotnetrestore
。在那之后,newtonsoft json工作得很好。

在终端上运行这个命令(这是OpenSUSE控制台/终端。然而,同样的概念也适用于Ubuntu)


这应该可以解决问题。

您能解释一下吗?我在.NET核心类库解决方案中没有看到package.json文件。如果我在VS的命令提示符下键入“dotnet restore”,我也不知道应该在哪里键入它。它告诉我:命令“dotnet”无效。谢谢
xxxx@localhost:~/Path/To/Project>dotnet add package Newtonsoft.Json
xxxx@localhost:~/Path/To/Project>dotnet restore