I have
- .NET SDK (5.0.201)
- dotnet-ef (version '5.0.4')
- on Debian Linux
When I run any dotnet ef command, like dotnet ef migrations add InitialCreate or dotnet ef database update I receive the following error message:
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 is installed, if I run dotnet tool install --global dotnet-ef, it says:
Tool 'dotnet-ef' is already installed.
Funny thing is that this error does not happen always. There are days I do not see it at all, and there are days I can not get rid of it. This is happening since I have upgraded from .NET Core 3.1 to .Net 5.
Does anyone have a solution for this?
Update
I have found a workaround that temporarily solves the problem. Run:
dotnet tool uninstall --global dotnet-ef
dotnet tool install --global dotnet-ef
Then log out and log in again.
Update 2
An other workaround is to install the tool locally:
dotnet new tool-manifest
dotnet tool install dotnet-ef