.net core 未找到.NET 5 ef CLI工具安装

.net core 未找到.NET 5 ef CLI工具安装,.net-core,entity-framework-core,.net Core,Entity Framework Core,我有 .NET SDK(5.0.201) dotnet ef(版本“5.0.4”) 关于DebianLinux 当我运行任何dotnet ef命令时,如dotnet ef migrations add InitialCreate或dotnet ef database update我收到以下错误消息: Could not execute because the specified command or file was not found. Possible reasons for this

我有

  • .NET SDK(5.0.201)
  • dotnet ef(版本“5.0.4”)
  • 关于DebianLinux
当我运行任何dotnet ef命令时,如
dotnet ef migrations add InitialCreate
dotnet ef database update
我收到以下错误消息:

Could not execute because the specified command or file was not found.
Possible reasons for this include:
  * You misspelled a built-in dotnet command.
  * You intended to execute a .NET program, but dotnet-ef does not exist.
  * You intended to run a global tool, but a dotnet-prefixed executable with this name could not be found on the PATH.
dotnet ef
已安装,如果我运行
dotnet工具安装--global dotnet ef
,它会显示:

Tool 'dotnet-ef' is already installed.
有趣的是,这种错误并不总是发生。有些日子我根本看不到它,有些日子我无法摆脱它。自从我从.NETCore3.1升级到.NET5后,这种情况就发生了

有人能解决这个问题吗

更新

我找到了一个临时解决问题的方法。运行:

dotnet tool uninstall --global dotnet-ef
dotnet tool install --global dotnet-ef
然后注销并再次登录

更新2

另一种解决方法是在本地安装该工具:

dotnet new tool-manifest
dotnet tool install dotnet-ef

听起来像个虫子。您可以在这里@BernardVanderBeken记录问题,但我认为这不是EF核心,而是CLI/SDK错误。很好的一点是,在这里记录可能有助于确定是特定的还是一般的