我尝试使用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恢复时; 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
我可以看到冲突,但我不知道如何解决。