c# - Mono 编译错误 - 无法从程序集 'System.Runtime.CompilerServices.ReferenceAssemblyAttribute' 加载类型 'System'

标签 c# mono

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

我的单声道版本是 2.10.2

这是我收到的错误

Missing method .ctor in assembly /home/tmc/AcctTerm/System.dll, type System.Runtime.CompilerServices.ReferenceAssemblyAttribute Can't find custom attr constructor image: /home/tmc/AcctTerm/System.dll mtoken: 0x0a000054

Unhandled Exception: System.TypeLoadException: Could not load type 'System.Runtime.CompilerServices.ReferenceAssemblyAttribute' from assembly 'System'. 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 中。

请确保您使用的是 Mono 'dmcs 编译器(或 mcs with -sdk=4)以确保您正在链接具有当前属性的 mscorlib.dll (4.0) 版本。

关于c# - Mono 编译错误 - 无法从程序集 'System.Runtime.CompilerServices.ReferenceAssemblyAttribute' 加载类型 'System',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8873091/

相关文章:

c# - 阻止 ASP.NET 中的整数溢出

c# - 使第三方库实现接口(interface)的策略?

c# - TeeChart for Mono Android 无法编译

c# - 如何编写 T4 模板以从 Entity Framework 6 创建 DTO?

c# - 将 linq 查询转换为 observablecollection

javascript - 从 EXTJS ComboBox 的 JSON 存储中检索 url 参数

c++ - 在 C/C++ 程序中使用 Mono SGen 垃圾收集器

c# - 反序列化触发函数

c# - Monobjc::添加 NSStatusItem

c# - Debian 7 Linq To SQL 上的 Mono 字符串对象引用未设置为对象的实例