如果我使用Visual Studio 2015 Update 3创建一个新的ASP.NET Core MVC应用程序,它运行得很好.但是,如果我将所述应用程序更新并将其Nuget软件包更新到ASP.NET Core 1.0.1,我会收到以下构建错误:
Can not find runtime target for framework '.NETCoreApp,Version=v1.0' compatible with one of the target runtimes: 'win10-x64, win81-x64, win8-x64, win7-x64'. Possible cause
1. The project has not been restored or restore failed - run `dotnet restore`
2. The project does not list one of 'win10-x64, win81-x64, win8-x64, win7-x64' in the 'runtimes' section.
3. You may be trying to publish a library, which is not supported. Use `dotnet pack` to distribute libraries.
Run Code Online (Sandbox Code Playgroud)
这是一个错误,还是一些环境问题?
附录:
恢复日志看起来很好:
log : Restoring packages for <path to project>\project.json...
log : Restoring packages for tool 'Microsoft.AspNetCore.Server.IISIntegration.Tools' in E:\Software Projects\subq\src\SubQ.API\project.json...
log : Lock file has not changed. Skipping lock file write. Path: <path to project>\project.lock.json
log : <path to project>\project.json
log : Restore completed in 6210ms.
Run Code Online (Sandbox Code Playgroud)
project.json看起来像这样:
{
"dependencies": {
"Microsoft.AspNetCore.Mvc": "1.0.1",
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
"Microsoft.AspNetCore.Server.Kestrel": "1.0.1",
"Microsoft.EntityFrameworkCore.SqlServer": "1.0.1",
"Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0",
"Microsoft.Extensions.Configuration.FileExtensions": "1.0.0",
"Microsoft.Extensions.Configuration.Json": "1.0.0",
"Microsoft.Extensions.Logging": "1.0.0",
"Microsoft.Extensions.Logging.Console": "1.0.0",
"Microsoft.Extensions.Logging.Debug": "1.0.0",
"Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0",
"Microsoft.NETCore.App": "1.0.1"
},
"tools": {
"Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final"
},
"frameworks": {
"netcoreapp1.0": {
"imports": [
"dotnet5.6",
"portable-net45+win8"
],
"runtimes": {
"win10-x64": {}
}
}
},
"buildOptions": {
"emitEntryPoint": true,
"preserveCompilationContext": true
},
"runtimeOptions": {
"configProperties": {
"System.GC.Server": true
}
},
"publishOptions": {
"include": [
"wwwroot",
"Views",
"Areas/**/Views",
"appsettings.json",
"web.config"
]
},
"scripts": {
"postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
}
}
Run Code Online (Sandbox Code Playgroud)
已安装最新的SDK.
小智 5
根据https://github.com/dotnet/core/issues/267:当使用nuget更新时,"类型":"平台"被删除,这有效地将项目更改为独立,因此将强制要求运行时段.
为我手动添加"type":"platform"到project.json文件解决了问题.
"dependencies": {
"Microsoft.NETCore.App": {
"version": "1.0.1",
"type": "platform"
},
Run Code Online (Sandbox Code Playgroud)
并且还要求https://github.com/dotnet/core/issues/267:通过NuGet UI更新调用项目系统以更新project.json,"type":在编辑期间删除"platform".NuGet 3.5.0 RTM(尚未发布)将针对此问题提供解决方法.
| 归档时间: |
|
| 查看次数: |
616 次 |
| 最近记录: |