可能的原因包括:
  *你拼错了内置的 dotnet 命令。
  *你打算执行 .NET Core 程序,但 dotnet-ef 不存在。
  *你打算运行全局工具,但在路径上找不到名称前缀为 dotnet 的可执行文件。

.net core3.0 以上版本dotnet ef命令不在是sdk的一部分,需要单独安装,使用如下命令:(最新版)

dotnet tool install --global dotnet-ef

该命令默认安装的是最新版本,如果项目中使用的并不是最新版本,则还是不能使用,安装对应版本使用如下命令:(指定版本)

dotnet tool install --global dotnet-ef --version 3.1.1

不注意安装错误可使用卸载命令:

dotnet tool uninstall --global dotnet-ef

dotnet-ef安装成功后,还需要给项目引用nuget包:

dotnet add package Microsoft.EntityFrameworkCore.Design

操作失败的话检查一下版本号即可

相关文章:

  • 2021-07-16
  • 2022-12-23
  • 2021-08-25
  • 2021-09-06
  • 2022-12-23
  • 2021-11-05
  • 2022-12-23
  • 2021-10-27
猜你喜欢
  • 2021-07-04
  • 2021-10-01
  • 2022-12-23
  • 2022-12-23
  • 2021-09-26
相关资源
相似解决方案