3

我正在尝试使用 mono 使用 C# 和 dnu 创建一个简单的控制台应用程序。

我正在尝试在我的控制台应用程序中引用一个类库项目,您可以在下面描述的 project.json 文件中看到:

{
  "version": "1.0.0-*",
  "description": "SimpleDependecy Console Application",
  "tags": [""],
  "projectUrl": "",
  "licenseUrl": "",

  "dependencies": {
      "MessagePrinter": "1.0.0-*"
  },

  "commands": {
    "run": "run"
  },

  "frameworks": {
    "dnx451": {
    },
    "dnxcore50": {
      "dependencies": {
        "System.Collections": "4.0.10-beta-23109",
        "System.Console": "4.0.0-beta-23109",
        "System.Linq": "4.0.0-beta-23109",
        "System.Threading": "4.0.10-beta-23109",
        "Microsoft.CSharp": "4.0.0-beta-23109"
      }
    }
  }
}

类库的 project.json 文件为:

{
  "version": "1.0.0-*",
  "description": "MessagePrinter Class Library",
  "tags": [""],
  "projectUrl": "",
  "licenseUrl": "",

  "dependencies": {
    "System.Collections": "4.0.10-beta-23019",
    "System.Linq": "4.0.0-beta-23019",
    "System.Threading": "4.0.10-beta-23019",
    "Microsoft.CSharp": "4.0.0-beta-23019",
    "System.Runtime": "4.0.20-beta-*"
  },

  "frameworks": {
      "dotnet": {}
  }
}

当我运行 dnu restore 时;dnu build 我收到以下异常:

(1,29): DNX,Version=v4.5.1 error CS0433: The type 'AssemblyFileVersionAttribute' 
exists in both 'System.Runtime, Version=4.0.20.0, 
Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' 
and 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'

还有一些例外,例如:

error CS0518: Predefined type 'System.Void' is not defined or imported

我可以看到冲突,但我不知道如何解决它。

4

0 回答 0