I've been using VS for Mac for a while now with EF Core 2.2 and everything's been going alright. Today I updated VS for Mac since it was really out of date, and after the update I can no longer run the dotnet ef
command:
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.
Note that this is .NET Core 2.2 and EF Core 2.2, not 3.0. Everything I've read online is specific to 3.0, so could someone please instruct me on how to get this command to finally work? Here are some things I've already tried:
dotnet restore
Microsoft.EntityFrameworkCore.Design
packageMicrosoft.EntityFrameworkCore.Tools
packageMicrosoft.EntityFrameworkCore
For those that are having this issue after switching to zsh
(for example after upgrading to macOS Catalina): the default path for globally installed tools is not recognised by zsh
and now requires to reference the relevant path in your profile (.zshrc
).
This can be done by adding the following lines:
# Add .NET Core SDK global tools/packages
export PATH=$HOME/.dotnet/tools:$PATH"
See further background on why this was different from bash
in: https://github.com/dotnet/cli/issues/9321