问题描述
我正在尝试编译此Json.NET代码:
I am trying to compile this Json.NET code:
using Newtonsoft.Json;
...
MyDesc d = JsonConvert.DeserializeObject<MyDesc>(jsonInput);
...
通过mono使用此命令(在ubuntu上):
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
正确的Json.NET Mono组装参考是什么?
What is the correct Json.NET Mono assebmly reference?
(-lib选项对此很合适,但-lib:PATH1[,PATHn] Specifies the location of referenced assemblies
无效)
(-lib option looks right for this, but it does not work -lib:PATH1[,PATHn] Specifies the location of referenced assemblies
)
推荐答案
引用其他程序集的mono编译器命令为-r:PATH/TO/ASSEMBLY
.您应该尝试使用当前版本的mono.
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
参考: http://linux.die.net/man/1/mcs或输入您的shell:
Reference: http://linux.die.net/man/1/mcs or type into your shell:
$ man mcs
这篇关于什么是Json.NET Mono程序集参考?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!