未能从程序集加载类型System.Runtime.Versioning.TargetFrameWorkAttribute [英] Could not load type System.Runtime.Versioning.TargetFrameWorkAttribute from assembly

查看:3217
本文介绍了未能从程序集加载类型System.Runtime.Versioning.TargetFrameWorkAttribute的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图编译使用库 Newtonsoft.Json.dll 与单程序

I am trying to compile a program that uses the library Newtonsoft.Json.dll with 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

和再尝试运行程序时(单的Program.exe )它抛出的错误:从未能加载类型'System.Runtime.Versioning.TargetFrameworkAttribute':

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 

我从来没有使用单面前,根本不知道发生了什么事..但也许这意味着DLL可以' T为使用,因为它没有被编译单呢?如果是这样的话;这是否意味着我不能使用任何3D方的DLL单声道,除非我也有源代码?

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?

推荐答案

由于默认情况下单采用2.0版运行时,但的NuGet使用V4.0。

Because default mono uses v 2.0 runtime but nuget is using v4.0. its can be resolve by defining runtime parameter on mono:

mono --runtime=v4.0.30319 NuGet.exe

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

这篇关于未能从程序集加载类型System.Runtime.Versioning.TargetFrameWorkAttribute的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆