mrward / monodevelop-nuget-extensions

Extends the MonoDevelop NuGet addin
MIT License
72 stars 9 forks source link

The command 'dotnet' is not recognized as the name of a cmlet" in Nuget Package Manager #39

Closed apphipster closed 2 years ago

apphipster commented 4 years ago

I get the following Error in the Nuget Package Manager Console

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.

I am using:

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.

Note: The PATH is not changing and I can run the dotnet command using terminal whereas in Visual Studio NuGet Package Manager it is throwing the error.

The issue was posted to the developer community web page: https://developercommunity.visualstudio.com/content/problem/913964/dotnet-the-term-dotnet-is-not-recognized-as-the-na.html

And also to stackoverflow: https://stackoverflow.com/questions/60141935/dotnet-is-not-recognized-as-the-name-of-a-cmdlet-macos/62122846#62122846

mrward commented 4 years ago

Running dotnet from the terminal is not quite the same as running it from VS Mac. The Terminal has a different PATH compared with GUI applications.

Was mainly wondering what the PATH is in the NuGet Package Manager Console.

Also is there a callstack or more information available on the $error variable? Possibly not based on your feedback post.

Is there a good way to reproduce this?

sandifb commented 3 years ago

Reinstall NuGet Package Manager Console -> restart your VS for Mac, I solve with that

azeem-sarwar commented 2 years ago

Just restart your IDE. Its works for me.

mrward commented 2 years ago

This should be fixed in latest release for VS Mac 17.0. Two changes were made: Ensure dotnet is available on the PATH when the PowerShell console is used. Also PowerShell v7 is now hosted in process in VS Mac 17.0, instead of being out of process.