MVC 包不兼容 [英] MVC package not compatible
本文介绍了MVC 包不兼容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试将我的项目更新到 dotnet core 1.1.我安装了给定的 dotnet 核心 SDK(准确地说是 1.0.0-preview2-1-003177)并创建了一个新的 Core WebAPI 项目,并按照升级文档中的说明更新了包.
I am trying to update my project to dotnet core 1.1. I installed the given dotnet core SDK (1.0.0-preview2-1-003177 to be exact) and created a new Core WebAPI project and I updated the package as per given in upgrade document.
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
Here is my 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%" ]
}
}
有人可以帮我吗?
推荐答案
已经在问题本身添加了一个答案,把它作为我自己对这个问题的答案.
- 转到命令提示符并点击此命令
dotnet --version
- 复制sdk版本
- 转到解决方案的 global.json 并用复制的版本号替换版本.global.json 应该是这样的.
global.json
{
"projects": [ "src", "test" ],
"sdk": {
"version": "1.0.0-preview2-1-003177"
}
}
另一种方法是完全删除版本.(感谢@Tseng 的建议)
alternative way is to remove version completely. (Thanks @Tseng for suggestion)
清理、重建和恢复软件包.应该可以.
Clean, rebuild and restore packages. Should work.
这篇关于MVC 包不兼容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文