单声道编译错误 – 无法从程序集“系统”加载类型“System.Runtime.CompilerServices.ReferenceAssemblyAttribute”

我在编译CSharp Mono应用程序时遇到问题。

我的单声道版本是2.10.2

这是我收到的错误

程序集中缺少方法.ctor /home/tmc/AcctTerm/System.dll,类型为System.Runtime.CompilerServices.ReferenceAssemblyAttribute找不到自定义attr构造函数图像:/home/tmc/AcctTerm/System.dll mtoken:0x0a000054

未处理的exception:System.TypeLoadException:无法从程序集“System”加载类型“System.Runtime.CompilerServices.ReferenceAssemblyAttribute”。 at conAccountTerminator.cjcAccountTerminator..ctor()[0x00000] in:0 at conAccountTerminator.MainClass.Main(System.String [] args)[0x00000] in:0

有任何想法吗?

编辑:添加代码;

using System; using System.Net; using System.Collections; using System.Web; using System.Text; using System.IO; using MySql; using MySql.Data; using MySql.Data.MySqlClient; using System.Security; using System.Security.Authentication; using System.Net.Security; using System.Security.Cryptography; using System.Security.Cryptography.X509Certificates; using System.Data; using System.Xml; namespace conAccountTerminator { class MainClass { public static void Main(string[] args) { cjcAccountTerminator cjcAccountTerm = new cjcAccountTerminator(); switch (args[0]) { case "update": cjcAccountTerm.LoginToMyBilling(); break; case "notepad": cjcAccountTerm.UpdateCustomerData(args[1], args[2]); break; case "terminate": cjcAccountTerm.TerminateAccount(args[1]); break; } } } } 

ReferenceAssemblyAttribute是最近的属性,在FX 4.0中首次出现。

请确保您使用的是-sdk=4编译器(或带有-sdk=4 mcs ),以确保您链接的是具有该属性的mscorlib.dll (4.0)版本。