首页 新闻 会员 周边

对asp.net core项目进行dotnet restore出错

0
悬赏园豆:30 [已解决问题] 解决于 2016-03-04 15:19

错误信息如下:

Errors in /git/AboutUs/project.json
    Microsoft.CodeAnalysis.CSharp 1.1.0-rc1-20151109-01 is not compatible with DNXCore,Version=v5.0.
    Ix-Async 1.2.5 is not compatible with DNXCore,Version=v5.0.
    Remotion.Linq 2.0.2 is not compatible with DNXCore,Version=v5.0.
    Microsoft.CodeAnalysis.Common 1.1.0-rc1-20151109-01 is not compatible with DNXCore,Version=v5.0.
    Some packages are not compatible with DNXCore,Version=v5.0.
    Microsoft.CodeAnalysis.CSharp 1.1.0-rc1-20151109-01 is not compatible with DNXCore,Version=v5.0 (ubuntu.14.04-x64).
    Microsoft.CodeAnalysis.Common 1.1.0-rc1-20151109-01 is not compatible with DNXCore,Version=v5.0 (ubuntu.14.04-x64).
    Ix-Async 1.2.5 is not compatible with DNXCore,Version=v5.0 (ubuntu.14.04-x64).
    Remotion.Linq 2.0.2 is not compatible with DNXCore,Version=v5.0 (ubuntu.14.04-x64).
    Microsoft.Win32.Registry 4.0.0-rc3-23903 provides a compile-time reference assembly for Microsoft.Win32.Registry on DNXCore,Version=v5.0, but there is no run-time assembly compatible with ubuntu.14.04-x64.
    Some packages are not compatible with DNXCore,Version=v5.0 (ubuntu.14.04-x64).

NuGet Config files used:
    /git/AboutUs/NuGet.Config
    /root/.nuget/NuGet/NuGet.Config

Feeds used:
    https://www.myget.org/F/aspnetcidev/api/v3/index.json
    https://api.nuget.org/v3/index.json
    https://www.myget.org/F/dotnet-core/api/v3/index.json
    https://www.myget.org/F/dotnet-cli/api/v3/index.json
    https://dotnet.myget.org/F/cli-deps/api/v3/index.json

 

dotnet cli的版本是:

.NET Command Line Tools (1.0.0-dev-001698)

project.json中的内容是:

{
    "webroot": "wwwroot",
    "exclude": ["wwwroot"],
    "dependencies":{
	"NETStandard.Library": "1.0.0-*",
        "Microsoft.AspNetCore.Mvc": "1.0.0-*",
        "Microsoft.AspNetCore.StaticFiles": "1.0.0-*",
        "Microsoft.AspNetCore.Diagnostics": "1.0.0-*",
        "Microsoft.EntityFrameworkCore.SqlServer": "1.0.0-*",
	"Microsoft.Extensions.Logging.Console": "1.0.0-*"
    },
    "frameworks":{
        "dnxcore50": {}
    }
}

请问如何解决这个问题?

问题补充:

在project.json的frameworks -> dnxcore50下添加 "imports": "portable-net451+win8" 之后,错误变成了:

Errors in /git/AboutUs/project.json
    Microsoft.Win32.Registry 4.0.0-rc3-23903 provides a compile-time reference assembly for Microsoft.Win32.Registry on DNXCore,Version=v5.0, but there is no run-time assembly compatible with ubuntu.14.04-x64.
    Some packages are not compatible with DNXCore,Version=v5.0 (ubuntu.14.04-x64).
dudu的主页 dudu | 高人七级 | 园豆:30994
提问于:2016-03-04 11:28
< >
分享
最佳答案
0

太奇怪了!只要在project.json中添加如下的配置,问题就解决了:

"tools": {
      "dotnet-publish-iis": "1.0.0-*"
    }

可以正常dotnet restore的完整project.json如下:

{
    "webroot": "wwwroot",
    "exclude": ["wwwroot"],
    "dependencies":{
	"NETStandard.Library": "1.0.0-*",
        "Microsoft.AspNetCore.Mvc": "1.0.0-*",
        "Microsoft.AspNetCore.StaticFiles": "1.0.0-*",
        "Microsoft.AspNetCore.Diagnostics": "1.0.0-*",
        "Microsoft.EntityFrameworkCore.SqlServer": "1.0.0-*",
	"Microsoft.Extensions.Logging.Console": "1.0.0-*"
    },
    "frameworks":{
        "dnxcore50": {}
    },
    "tools": {
      "dotnet-publish-iis": "1.0.0-*"
    }
}
dudu | 高人七级 |园豆:30994 | 2016-03-04 15:18
其他回答(1)
0

dudu 这是要自问自答吗?

收获园豆:30
花儿笑弯了腰 | 园豆:264 (菜鸟二级) | 2016-03-04 14:58
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册