我正在尝试在Linux和MonoDevelop上开始使用JSON.NET的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";
}
}
}
当我尝试运行程序时,它给出以下错误:The type or namespace name 'Newtonsoft' could not be found. Are you missing an assembly reference?
MonoDevelop为什么找不到我安装的库?