问题
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