Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/25.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 Linux上的JSON.NET_C#_.net_Json_Ubuntu_Mono - Fatal编程技术网

C# Ubuntu Linux上的JSON.NET

C# Ubuntu Linux上的JSON.NET,c#,.net,json,ubuntu,mono,C#,.net,Json,Ubuntu,Mono,我正在尝试在Linux和MonoDevelop上开始使用JSON.NET for Mono。我在存储库中找到了这些包,因此我使用sudo apt get install libnewtonsoft json cil dev libnewtonsoft json cil monodoc newtonsoft json manual安装了它们 我有以下代码来测试安装是否有效: using System; using Gtk; using Newtonsoft.Json; namespace jso

我正在尝试在Linux和MonoDevelop上开始使用JSON.NET for Mono。我在存储库中找到了这些包,因此我使用
sudo apt get install libnewtonsoft json cil dev libnewtonsoft json cil monodoc newtonsoft json manual安装了它们

我有以下代码来测试安装是否有效:

using System;
using Gtk;
using Newtonsoft.Json;

namespace jsontest
{
    class MainClass
    {
        public static void Main (string[] args)
        {
            Application.Init ();

            Car my_car = new Car ();
            string json = JsonConvert.SerializeObject (my_car);

            MainWindow win = new MainWindow ();
            win.Show ();
            Application.Run ();
        }
    }

    public class Car
    {
        public string make;
        public string model;

        public Car()
        {
            make = "ford";
            model = "jalopy";
        }
    }
}
当我尝试运行该程序时,它给出了以下错误:
找不到类型或命名空间名称“Newtonsoft”。是否缺少程序集引用?


为什么MonoDevelop找不到我安装的库?

通过apt get安装后

此dll在Mono GAC中可用,您应该能够通过添加新引用在MonoDevelop中访问它必须手动添加此引用,否则会收到错误消息


这并非“意外”,因为即使在Visual Studio中,如果没有正确获取引用,也会出现相同的错误消息。

这可能适用,也可能不适用,但在Windows上,如果您试图使用4.0/4.5客户端配置文件而不是完整配置文件编译项目设置,我有时会看到此错误。到目前为止,在联机查看时,我还没有看到任何关于不同配置文件的信息。我在哪里能读到这个?和