1

我使用 YeoMan 创建了我的项目。在我的 project.json 中,我有这些框架:

"frameworks": {
    "dnx451": { },
    "dnxcore50": {
        "dependencies": {
            "System.Runtime.Serialization.Primitives": "4.0.10-*"
        }
    }
}

如果我进行“dnu build”,我会收到很多错误,但如果我删除“dnx451”,一切正常。

我已经阅读了很多关于什么是“dnx451”和什么是“dnxcore50”的问题,但我的问题是......

我可以在 Linux 或 Mac 中同时使用 dnx451 和 dnxcore50 框架吗?在肯定的情况下,我该如何安装 dnx451?

编辑:添加错误:

    Unable to resolve dependency fx/mscorlib 

  Unable to resolve dependency fx/System 

  Unable to resolve dependency fx/System.Core 

  Unable to resolve dependency fx/Microsoft.CSharp 

  Unable to resolve dependency fx/System.Collections 

  Unable to resolve dependency fx/System.ComponentModel.DataAnnotations 

  Unable to resolve dependency fx/System.Diagnostics.Debug 

  Unable to resolve dependency fx/System.Diagnostics.Tools 

  Unable to resolve dependency fx/System.Globalization 

  Unable to resolve dependency fx/System.Linq 

  Unable to resolve dependency fx/System.Linq.Expressions 

  Unable to resolve dependency fx/System.Linq.Queryable 

  Unable to resolve dependency fx/System.ObjectModel 

  Unable to resolve dependency fx/System.Reflection 

  Unable to resolve dependency fx/System.Reflection.Extensions 

  Unable to resolve dependency fx/System.Resources.ResourceManager 

  Unable to resolve dependency fx/System.Runtime 

  Unable to resolve dependency fx/System.Runtime.Extensions 

  Unable to resolve dependency fx/System.Threading 

  Unable to resolve dependency fx/System.Data 

  Unable to resolve dependency fx/System.Transactions 

  Unable to resolve dependency fx/System.Net.Http 

  Unable to resolve dependency fx/System.IO 

  Unable to resolve dependency fx/System.Security 

  Unable to resolve dependency fx/System.Xml 

  Unable to resolve dependency fx/System.Xml.Linq 

  Unable to resolve dependency fx/System.Configuration 

  Unable to resolve dependency fx/System.Threading.Tasks 

  Unable to resolve dependency fx/System.Text.Encoding 

  Unable to resolve dependency fx/System.Collections.Concurrent 

/Users/chemitaxis/Downloads/MusicStore-dev/src/MusicStore/project.json(0,0): error NU1001: The dependency fx/mscorlib  could not be resolved.
/Users/chemitaxis/Downloads/MusicStore-dev/src/MusicStore/project.json(0,0): error NU1001: The dependency fx/System  could not be resolved.
/Users/chemitaxis/Downloads/MusicStore-dev/src/MusicStore/project.json(0,0): error NU1001: The dependency fx/System.Core  could not be resolved.
/Users/chemitaxis/Downloads/MusicStore-dev/src/MusicStore/project.json(0,0): error NU1001: The dependency fx/Microsoft.CSharp  could not be resolved.
/Users/chemitaxis/Downloads/MusicStore-dev/src/MusicStore/project.json(0,0): error NU1001: The dependency fx/System.Collections  could not be resolved.
/Users/chemitaxis/Downloads/MusicStore-dev/src/MusicStore/project.json(0,0): error NU1001: The dependency fx/System.ComponentModel.DataAnnotations  could not be resolved.
/Users/chemitaxis/Downloads/MusicStore-dev/src/MusicStore/project.json(0,0): error NU1001: The dependency fx/System.Diagnostics.Debug  could not be resolved.
/Users/chemitaxis/Downloads/MusicStore-dev/src/MusicStore/project.json(0,0): error NU1001: The dependency fx/System.Diagnostics.Tools  could not be resolved.
/Users/chemitaxis/Downloads/MusicStore-dev/src/MusicStore/project.json(0,0): error NU1001: The dependency fx/System.Globalization  could not be resolved.
/Users/chemitaxis/Downloads/MusicStore-dev/src/MusicStore/project.json(0,0): error NU1001: The dependency fx/System.Linq  could not be resolved.
/Users/chemitaxis/Downloads/MusicStore-dev/src/MusicStore/project.json(0,0): error NU1001: The dependency fx/System.Linq.Expressions  could not be resolved.
/Users/chemitaxis/Downloads/MusicStore-dev/src/MusicStore/project.json(0,0): error NU1001: The dependency fx/System.Linq.Queryable  could not be resolved.
/Users/chemitaxis/Downloads/MusicStore-dev/src/MusicStore/project.json(0,0): error NU1001: The dependency fx/System.ObjectModel  could not be resolved.
/Users/chemitaxis/Downloads/MusicStore-dev/src/MusicStore/project.json(0,0): error NU1001: The dependency fx/System.Reflection  could not be resolved.
/Users/chemitaxis/Downloads/MusicStore-dev/src/MusicStore/project.json(0,0): error NU1001: The dependency fx/System.Reflection.Extensions  could not be resolved.
/Users/chemitaxis/Downloads/MusicStore-dev/src/MusicStore/project.json(0,0): error NU1001: The dependency fx/System.Resources.ResourceManager  could not be resolved.
/Users/chemitaxis/Downloads/MusicStore-dev/src/MusicStore/project.json(0,0): error NU1001: The dependency fx/System.Runtime  could not be resolved.
/Users/chemitaxis/Downloads/MusicStore-dev/src/MusicStore/project.json(0,0): error NU1001: The dependency fx/System.Runtime.Extensions  could not be resolved.
/Users/chemitaxis/Downloads/MusicStore-dev/src/MusicStore/project.json(0,0): error NU1001: The dependency fx/System.Threading  could not be resolved.
/Users/chemitaxis/Downloads/MusicStore-dev/src/MusicStore/project.json(0,0): error NU1001: The dependency fx/System.Data  could not be resolved.
/Users/chemitaxis/Downloads/MusicStore-dev/src/MusicStore/project.json(0,0): error NU1001: The dependency fx/System.Transactions  could not be resolved.
/Users/chemitaxis/Downloads/MusicStore-dev/src/MusicStore/project.json(0,0): error NU1001: The dependency fx/System.Net.Http  could not be resolved.
/Users/chemitaxis/Downloads/MusicStore-dev/src/MusicStore/project.json(0,0): error NU1001: The dependency fx/System.IO  could not be resolved.
/Users/chemitaxis/Downloads/MusicStore-dev/src/MusicStore/project.json(0,0): error NU1001: The dependency fx/System.Security  could not be resolved.
/Users/chemitaxis/Downloads/MusicStore-dev/src/MusicStore/project.json(0,0): error NU1001: The dependency fx/System.Xml  could not be resolved.
/Users/chemitaxis/Downloads/MusicStore-dev/src/MusicStore/project.json(0,0): error NU1001: The dependency fx/System.Xml.Linq  could not be resolved.
/Users/chemitaxis/Downloads/MusicStore-dev/src/MusicStore/project.json(0,0): error NU1001: The dependency fx/System.Configuration  could not be resolved.
/Users/chemitaxis/Downloads/MusicStore-dev/src/MusicStore/project.json(0,0): error NU1001: The dependency fx/System.Threading.Tasks  could not be resolved.
/Users/chemitaxis/Downloads/MusicStore-dev/src/MusicStore/project.json(0,0): error NU1001: The dependency fx/System.Text.Encoding  could not be resolved.
/Users/chemitaxis/Downloads/MusicStore-dev/src/MusicStore/project.json(0,0): error NU1001: The dependency fx/System.Collections.Concurrent  could not be resolved.
error CS8021: No value for RuntimeMetadataVersion found. No assembly containing System.Object was found nor was a value for RuntimeMetadataVersion specified through options.

谢谢!!

4

1 回答 1

2

由于您使用System.Runtime.Serialization.Primitivesunder dnxcore50,因此您还需要告知dnx451System.RuntimeandSystem.Runtime.Serialization库作为框架程序集拉入。

"dnx451": {
  "frameworkAssemblies": {
    "System.Runtime": "",
    "System.Runtime.Serialization": ""
  }
}

根据您使用的类,您可能还需要引入System.Xml(或它抱怨的任何其他库dnu build

于 2015-12-10T06:48:19.947 回答