【问题标题】:Getting an "The framework 'Microsoft.NETCore.App', version '3.1.0' (x64) was not found." when running ef migrations on a net6 project在 net6 项目上运行 ef 迁移时获取“框架 \'Microsoft.NETCore.App\',版本 \'3.1.0\' (x64) 未找到。\”
【发布时间】:2022-08-05 12:24:19
【问题描述】:

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

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

在执行 ef 迁移时,即使它完全是 net6(ef 核心的 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.

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

{
  \"version\": 1,
  \"isRoot\": true,
  \"tools\": {
    \"dotnet-ef\": {
      \"version\": \"6.0.6\",
      \"commands\": [
        \"dotnet-ef\"
      ]
    }
  }
}
  • 在代理上安装 .NET 6 SDK
  • .NET SDK 通过另一个步骤预先安装

标签: c# entity-framework azure-pipelines


【解决方案1】:

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

实体框架工具版本“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.App”,版本“3.1.0”(x64)。

通常,要构建 .NET 5 应用程序,需要 .NET Core 3 SDK 并与 5.0 版本一起安装。

可能是您的项目与 .NET Core 3 有依赖关系,因此请安装并检查一次。

【讨论】:

    猜你喜欢
    • 2022-07-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-08-19
    • 2022-06-14
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多