我想將我的項目更新到dotnet核心1.1。我安裝了給定的dotnet核心SDK(準確的說是1.0.0-preview2-1-003177),並創建了一個新的Core WebAPI項目,並根據升級文檔中的給定更新了軟件包。MVC包不兼容
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%" ]
}
}
誰能幫助我一樣嗎?
明白了,舊的sdk版本在global.json中被引用。這是問題所在。修正了它:-)添加一個解決方案 –