无法从程序集加载类型System.Runtime.Versioning.TargetFrameWorkAttribute

我正在尝试编译一个使用库Newtonsoft.Json.dll和mono的程序

编译命令

 gmcs Program.cs etcetera.cs -r:Newtonsoft.Json.dll -r:Argotic.Core.dll 

结果:

 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 

然后当尝试运行程序( mono Program.exe )时,它会抛出错误:

 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 :0 at my_program.TheObjDB.getAllSerialized () [0x00000] in :0 at my_program.Program.Main (System.String[] args) [0x00000] in :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 :0 at my_program.TheObjDB.getAllSerialized () [0x00000] in :0 at my_program.Program.Main (System.String[] args) [0x00000] in :0 

我之前从未使用过mono,也不知道发生了什么……但也许这意味着DLL无法使用,因为它还没有使用单声道编译? 如果是这样的话; 这是否意味着除非我也有源代码,否则我不能使用单声道的任何3d派对DLL?

因为默认单声道使用v 2.0运行时但nuget正在使用v4.0。 可以通过在mono上定义运行时参数来解决它:

 mono --runtime=v4.0.30319 NuGet.exe 

资料来源: http : //monomvc.wordpress.com/2012/03/06/nuget-on-mono/