I had the same issue. It happens randomly. Lost a couple of hours from my life until I found a workaround that solves the issue.
I am using:
- NuGet Package Manager Console (NuGet 5.6.0.5)
- in Visual Studio for Mac COMMUNITY Version 8.6.1
- and use it for Entity Framework commands
Example command:
PM> Update-Database
Build started...
Build succeeded.
The running command stopped because the preference variable "ErrorActionPreference" or common parameter is set to Stop: The term 'dotnet' is not recognized as the name of a cmdlet, function, script file, or operable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
A couple of minutes ago realized that by cleaning the project the issue goes away.
Visual Studio -> Build -> Clean All
Then when running again the command in NuGet PM it is executed without any issue.
PM> Update-Database
Build started...
Build succeeded.
No migrations were applied. The database is already up to date.
Done.
The issue was also posted to the developer community web page, but was soon closed without any resolution:
https://developercommunity.visualstudio.com/content/problem/913964/dotnet-the-term-dotnet-is-not-recognized-as-the-na.html
I am about to reconsider this issue. Hope they will come up with a fix.