gpt4 book ai didi

asp.net-core - ASP.NET Core 1.0.1 破坏项目

转载 作者:行者123 更新时间:2023-12-05 00:32:05 25 4
gpt4 key购买 nike

如果我使用 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.

这是错误还是环境问题?

附录:

还原日志看起来不错:

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.

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%" ]
}
}

已安装最新的 SDK。

最佳答案

根据 https://github.com/dotnet/core/issues/267 :使用 nuget 更新时,“type”:“platform”被删除,这有效地将项目更改为独立项目,从而强制要求运行时部分。

对我来说,手动添加 "type": "platform"到 project.json 文件解决了这个问题。

    "dependencies": {
"Microsoft.NETCore.App": {
"version": "1.0.1",
"type": "platform"
},

还有协调 https://github.com/dotnet/core/issues/267 :通过 NuGet UI 更新调用项目系统以更新 project.json,“类型”:“平台”在该编辑期间被删除。 NuGet 3.5.0 RTM(尚未发布)将针对此问题提供解决方法。

关于asp.net-core - ASP.NET Core 1.0.1 破坏项目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39735634/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com