What is the Json.NET Mono assembly reference?

孤街醉人 提交于 2020-01-03 16:02:58

问题


I am trying to compile this Json.NET code:

using Newtonsoft.Json;
...
MyDesc d = JsonConvert.DeserializeObject<MyDesc>(jsonInput);
...

with this command via mono (on ubuntu):

$ mcs Main.cs -lib:/home/username/JsonNET/Net40/Newtonsoft.Json.dll

But i am getting "no assembly reference"-error:

error CS0246: The type or namespace name `Newtonsoft' could not be found.
Are you missing an assembly reference

What is the correct Json.NET Mono assebmly reference?

(-lib option looks right for this, but it does not work -lib:PATH1[,PATHn] Specifies the location of referenced assemblies )


回答1:


The mono compiler command to reference other assemblies is -r:PATH/TO/ASSEMBLY. You should try this with the current version of mono.

$ mcs Main.cs -r:/home/username/JsonNET/Net40/Newtonsoft.Json.dll

Reference: http://linux.die.net/man/1/mcs or type into your shell:

$ man mcs


来源:https://stackoverflow.com/questions/36550910/what-is-the-json-net-mono-assembly-reference

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!