I am trying to compile a program that uses the library Newtonsoft.Json.dll
with mono
Compile command
gmcs Program.cs etcetera.cs -r:Newtonsoft.Json.dll -r:Argotic.Core.dll
Result:
Missing method .ctor in assembly Newtonsoft.Json.dll, type System.Runtime.Versioning.TargetFrameworkAttribute
Can't find custom attr constructor image: Newtonsoft.Json.dll mtoken: 0x0a000053
And then when trying to run the program (mono Program.exe
) it throws the error:
Unhandled Exception: System.TypeLoadException: Could not load type 'System.Runtime.Versioning.TargetFrameworkAttribute' from assembly 'Newtonsoft.Json'.
at my_program.CJSONStuff.serialize (System.Collections.Generic.Dictionary`2 obj) [0x00000] in <filename unknown>:0
at my_program.TheObjDB.getAllSerialized () [0x00000] in <filename unknown>:0
at my_program.Program.Main (System.String[] args) [0x00000] in <filename unknown>:0
[ERROR] FATAL UNHANDLED EXCEPTION: System.TypeLoadException: Could not load type 'System.Runtime.Versioning.TargetFrameworkAttribute' from assembly 'Newtonsoft.Json'.
at my_program.CJSONStuff.serialize (System.Collections.Generic.Dictionary`2 obj) [0x00000] in <filename unknown>:0
at my_program.TheObjDB.getAllSerialized () [0x00000] in <filename unknown>:0
at my_program.Program.Main (System.String[] args) [0x00000] in <filename unknown>:0
I have never used mono before, and have no idea what's going on.. but maybe this means the DLL can't be used because it hasn't been compiled with mono as well? If that's the case; does this mean I can't use any 3d party DLLs with mono unless I also have the source code?
Because default mono uses v 2.0 runtime but nuget is using v4.0. its can be resolve by defining runtime parameter on mono:
Source: http://monomvc.wordpress.com/2012/03/06/nuget-on-mono/