错误信息如下:
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).
太奇怪了!只要在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 这是要自问自答吗?