我正在尝试将我的项目更新为dotnet核心1.1。我安装了给定的dotnet核心SDK(准确地说是1.0.0-preview2-1-003177)并创建了一个新的Core WebAPI项目,并按照升级文档中的说明更新了软件包。
error: Package Microsoft.AspNetCore.Mvc 1.1.0 is not compatible with netcoreapp1.1 (.NETCoreApp,Version=v1.1).
Package Microsoft.AspNetCore.Mvc 1.1.0 supports:
error: - net451 (.NETFramework,Version=v4.5.1)
error: - netstandard1.6 (.NETStandard,Version=v1.6)
error: One or more packages are incompatible with .NETCoreApp,Version=v1.1.
这是我的package.json
{
"dependencies": {
"Microsoft.AspNetCore.Authentication": "1.1.0",
"Microsoft.AspNetCore.Mvc": "1.1.0",
"Microsoft.AspNetCore.Server.IISIntegration": "1.1.0",
"Microsoft.AspNetCore.Server.Kestrel": "1.1.0",
"Microsoft.Extensions.Configuration.EnvironmentVariables": "1.1.0",
"Microsoft.Extensions.Configuration.FileExtensions": "1.1.0",
"Microsoft.Extensions.Configuration.Json": "1.1.0",
"Microsoft.Extensions.Logging": "1.1.0",
"Microsoft.Extensions.Logging.Console": "1.1.0",
"Microsoft.Extensions.Logging.Debug": "1.1.0",
"Microsoft.NETCore.App": "1.1.0"
},
"tools": {
"Microsoft.AspNetCore.Server.IISIntegration.Tools": {
"version": "1.0.0-preview1-final",
"imports": "portable-net45+win8+dnxcore50"
}
},
"frameworks": {
"netcoreapp1.1": {
"imports": [
"dotnet5.6",
"dnxcore50",
"portable-net45+win8"
]
}
},
"buildOptions": {
"emitEntryPoint": true,
"preserveCompilationContext": true
},
"runtimeOptions": {
"gcServer": true
},
"publishOptions": {
"include": [
"wwwroot",
"Views",
"appsettings.json",
"web.config"
]
},
"scripts": {
"postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
}
}
任何人都可以帮助我吗?
答案 0 :(得分:2)
已经添加了一个有问题的答案,将其作为我自己对此问题的回答。
dotnet --version
global.json
{
"projects": [ "src", "test" ],
"sdk": {
"version": "1.0.0-preview2-1-003177"
}
}
替代方法是完全删除版本。 (感谢@Tseng的建议)
清理,重建和恢复包。应该工作。