Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/docker/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 将多框架库从csproj切换到xproj/project.json_C#_.net_Dnx_Project.json - Fatal编程技术网

C# 将多框架库从csproj切换到xproj/project.json

C# 将多框架库从csproj切换到xproj/project.json,c#,.net,dnx,project.json,C#,.net,Dnx,Project.json,我正在尝试移动当前支持多个目标的现有库:Profile259、.NET 4.5、.NET 4.0客户端配置文件和NetCore451(Win 8.1+)。根据目标框架的不同,我需要两组直接依赖项:Microsoft.Net.Http(PCL和.Net 4.0)和Json.Net(所有目标) 我已经能够转移到特定的平台目标,如.NET 4.5、.NET 4.0 CP、.NET 4.6等。但是,我遇到了针对PCL的问题 使用以下project.json "frameworks": { ".NETPo

我正在尝试移动当前支持多个目标的现有库:Profile259、.NET 4.5、.NET 4.0客户端配置文件和NetCore451(Win 8.1+)。根据目标框架的不同,我需要两组直接依赖项:Microsoft.Net.Http(PCL和.Net 4.0)和Json.Net(所有目标)

我已经能够转移到特定的平台目标,如.NET 4.5、.NET 4.0 CP、.NET 4.6等。但是,我遇到了针对PCL的问题

使用以下project.json

"frameworks": {
".NETPortable,Version=v4.5,Profile=Profile259": {
  "compilationOptions": { "define": [ "Portable" ] },
  "dependencies": {
    "Newtonsoft.Json": "8.0.2",
    "Microsoft.Net.Http": "2.2.29"
  },
  "frameworkAssemblies": {
    "Microsoft.CSharp": "",
    "mscorlib": "",
    "System.Collections": "",
    "System.ComponentModel": "",
    "System.Diagnostics.Debug": "",
    "System.Dynamic.Runtime": "",
    "System.Globalization": "",
    "System.IO": "",
    "System.Linq": "",
    "System.Linq.Expressions": "",
    "System.Linq.Queryable": "",
    "System.Net": "",
    "System.Net.Primitives": "",
    "System.Net.Requests": "",
    "System.ObjectModel": "",
    "System.Reflection": "",
    "System.Reflection.Extensions": "",
    "System.Runtime": "",
    "System.Runtime.Extensions": "",
    "System.Text.Encoding": "",
    "System.Text.RegularExpressions": "",
    "System.Threading": "",
    "System.Threading.Tasks": ""
  }
},
"netcore451": {
  "dependencies": {
    "Newtonsoft.Json": "8.0.2"
  },
  "frameworkAssemblies": {
    "Microsoft.CSharp": "4.0.0",
    "mscorlib": "4.0.0",
    "System.Collections": "4.0.0",
    "System.ComponentModel": "4.0.0",
    "System.Diagnostics.Debug": "4.0.0",
    "System.Dynamic.Runtime": "4.0.0",
    "System.Globalization": "4.0.0",
    "System.IO": "4.0.0",
    "System.Linq": "4.0.0",
    "System.Linq.Expressions": "4.0.0",
    "System.Linq.Queryable": "4.0.0",
    "System.Net": "4.0.0",
    "System.Net.Http": "4.0.0",
    "System.Net.Primitives": "4.0.0",
    "System.Net.Requests": "4.0.0",
    "System.ObjectModel": "4.0.0",
    "System.Reflection": "4.0.0",
    "System.Reflection.Extensions": "4.0.0",
    "System.Runtime": "4.0.10",
    "System.Runtime.Extensions": "4.0.0",
    "System.Text.Encoding": "4.0.0",
    "System.Text.RegularExpressions": "4.0.0",
    "System.Threading": "4.0.0",
    "System.Threading.Tasks": "4.0.0"
  },
  "compilationOptions": {
    "define": [ "Async", "NETFX_CORE" ]
  }
}}
我最终会犯一些有趣的错误,比如:

.NETPortable,Version=v4.5,Profile=Profile259 error CS0012: The type 'Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes'.

.NETCore,Version=v4.5.1 error CS0012: The type 'Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes'.
我可以从配置文件259切换到配置文件111,并删除对Microsoft.Net.Http的依赖,这解决了PCL问题

对于netcore451,如果删除对Json.NET的引用,系统引用问题将得到解决,但库将不再编译

长话短说,有什么建议吗?或者说,我是不是受我所依赖的图书馆的摆布而做出了一些改变