【问题标题】:How to upgrade EF Core Tools如何升级 EF Core 工具
【发布时间】:2019-03-13 02:52:16
【问题描述】:

当我add-migration 时,我收到了这个警告:

The EF Core tools version '2.1.1-rtm-30846' is older than that of the runtime '2.1.4-rtm-31024'. Update the tools for the latest features and bug fixes.

除了更新 DotNET Core SDK 外,我没有找到任何信息如何更新它,但这对我不起作用。

【问题讨论】:

  • 将项目的实体框架核心包更新到 2.1.4。
  • @TanvirArjel 它的版本已经是2.1.4 但问题仍然存在
  • 哦!删除bin文件夹后你试过了吗?
  • 这些工具包含在 EF Core NuGet 包中。
  • @TanvirArjel 我试图删除 bin 文件夹,但问题仍然存在

标签: entity-framework asp.net-core


【解决方案1】:

使用包管理器控制台更新工具:

Install-Package Microsoft.EntityFrameworkCore.Tools -Version 2.1.4

查看此链接https://www.nuget.org/packages/Microsoft.EntityFrameworkCore.Tools/

【讨论】:

  • 我觉得自己像个白痴一样询问并感谢您,因为这已经奏效了 - 但是,为什么在 Nuget 中查找更新时没有显示?
  • 此解决方案有效,而 dotnet tool update... 解决方案无效,无论我是在 NuGet 包管理器控制台还是从 Windows 终端执行命令。
【解决方案2】:

如果您使用命令行(CMD、Powershell、bash 等),您可以轻松输入以下内容以更新到最新版本:

dotnet tool update --global dotnet-ef

如果您想更新到非常具体的版本,请执行以下操作:

dotnet tool update --global dotnet-ef --version VERSION_NUMBER

例子:

dotnet tool update --global dotnet-ef --version 3.1.0

【讨论】:

    【解决方案3】:

    如果您在为全局环境运行更新命令后仍然看到错误,则搭载 daniel-chikaka 的解决方案。

    dotnet tool update --global dotnet-ef
    

    尝试删除 --global 参数,以便它更新与项目关联的 dotnet-tools.json 文件。

    dotnet tool update dotnet-ef
    

    【讨论】:

      猜你喜欢
      • 2021-11-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-02-06
      • 1970-01-01
      • 2012-08-21
      • 2014-02-06
      相关资源
      最近更新 更多