Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the Json.NET Mono assembly reference?

Tags:

json.net

mono

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 )

like image 649
AvrDragon Avatar asked Apr 11 '16 13:04

AvrDragon


1 Answers

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
like image 171
Toxantron Avatar answered Jan 02 '23 11:01

Toxantron