在 net6 项目上运行 ef 迁移时获取"The framework 'Microsoft.NETCore.App', version '3.1.0' (x64) was not found



当我尝试在Azure Devops中构建应用程序时,我一直遇到错误

The framework 'Microsoft.NETCore.App', version '3.1.0' (x64) was not found. 

在执行ef迁移时,即使它是完全net6 (ef core的nuget包也是6.0)。

然而,有一个代理被dotnet 3.1 sdk污染了,它生成以下消息:

The Entity Framework tools version '3.1.0' is older than that of the runtime '6.0.5'. Update the tools for the latest features and bug fixes. See https://aka.ms/AAc1fbw for more information.

,这是奇怪的,因为我安装了ef工具之前运行以下命令dotnet-tools.json

{
"version": 1,
"isRoot": true,
"tools": {
"dotnet-ef": {
"version": "6.0.6",
"commands": [
"dotnet-ef"
]
}
}
}

请检查以下步骤是否有助于解决问题:

实体框架工具版本'3.1.0'比运行时'6.0.5'老。为最新的特性和错误修复更新工具。详见https://aka.ms/AAc1fbw

这个错误清楚地说明要将实体框架工具版本从3.1.0更新到6.0.5,你可以使用下面的命令来更新它:

dotnet tool update --global dotnet-ef --version 6.0.5

或者您也可以使用最新版本命令而不进行版本控制,例如:

dotnet tool update --global dotnet-ef

框架'Microsoft.NETCore。应用程序',版本'3.1.0' (x64)找不到。

正常情况下,5构建. net应用程序中,需要核心3 . net SDK和安装5.0版本。

可能是你的项目依赖于。net Core 3,所以安装它并检查一次。

相关内容