dotnet ef command no longer works after upgrading to Visual Studio 16.3.0

折月煮酒 提交于 2019-12-11 00:39:39

问题


This happened at home first, so I thought maybe it was an issue with my desktop PC at home. But now that I am back at work, I tried the upgrade and got the same thing.

Screenshot before upgrade

Screenshot after upgrading Visual Studio

The error I get is:

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 Core 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.

Any ideas on why this happens? And how do I get back the dotnet ef command. I mean must have been in the $PATH previously, otherwise it wouldn't have worked before.


回答1:


This is a breaking change in Entity Framework Core 3.0:

The EF Core command-line tool, dotnet ef, is no longer part of the .NET Core SDK.

...

Starting in 3.0, the .NET SDK does not include the dotnet ef tool, so before you can use it you have to explicitly install it as a local or global tool.

You need to install the Entity Framework Core Tools. To install it globally, run this on the command line:

dotnet tool install --global dotnet-ef


来源:https://stackoverflow.com/questions/58077073/dotnet-ef-command-no-longer-works-after-upgrading-to-visual-studio-16-3-0

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!