Kobus Myburgh
Kobus Myburgh

Reputation: 1202

dotnet: Works from Windows 10 command prompt, but not in VSCode

I am starting my journey into learning DotNet, and doing a demo application found on MS website, here: https://learn.microsoft.com/en-us/learn/modules/create-razor-pages-aspnet-core/3-exercise-create-new-aspnetcore-app.

I am getting the following error when trying to run dotnet in VSCode:

The term 'dotnet' is not recognized as the name of a cmdlet, but it works from command line.

Some information:

As far as I can tell, everything is correct, and the answers here do not work for me: dotnet is not recognized as the name of a cmdlet

My output when I do dotnet --version from the command prompt or PowerShell is:

C:\Users\bobandalice>dotnet --info
.NET SDK (reflecting any global.json):
Version:   6.0.100
Commit:    9e8b04bbff

Runtime Environment:
OS Name:     Windows
OS Version:  10.0.19042
OS Platform: Windows
RID:         win10-x64
Base Path:   C:\Program Files\dotnet\sdk\6.0.100\

Host (useful for support):
Version: 6.0.0
Commit:  4822e3c3aa

.NET SDKs installed:
6.0.100 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
Microsoft.AspNetCore.App 6.0.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 6.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 6.0.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

To install additional .NET runtimes or SDKs:
https://aka.ms/dotnet-download

When doing the same in VSCode, the output is this:

PS C:\Users\bobandalice\OneDrive\dotnetapps\RazorPagesPizza> dotnet --info
dotnet : 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.
At line:1 char:1
+ dotnet --info
+ ~~~~~~
    + CategoryInfo          : ObjectNotFound: (dotnet:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

Any ideas?

Upvotes: 3

Views: 1724

Answers (1)

jessieloo
jessieloo

Reputation: 1872

I'm having same issue. I'm not sure if this is ideal but this is something I figured out that seems to work. In the File -> Settings -> Preferences -> Features -> Terminal, I changed my terminal to external from integrated and it fixed the problem. I may be switching to Visual Studio Community also, though.

change terminal to external

Upvotes: 1

Related Questions