.Net 6.0 System Environment Variable

Jeremy Benson 1 Reputation point
2022-01-31T20:12:09.537+00:00

Hello.

I'm trying to use .Net 6.0 with Visual Studio Code. I've installed the C# extension in Visual Studio Code. I also installed the .Net 6.0 64x SDK for windows. I get a common error "The term 'dotnet' is not recognized as the name of a cmdlet." The problem is, I can't solve it. I check environment variables in control panel, but it didn't add anything new. I've tried creating a variable called donet and setting the value to C:\Program Files\dontnet and also C:\Program File\dotnet.exe. It didn't change the error. I'm new with system variables and doing this outside a working version of Visual Studio, so I need so easy to follow information. Is there an easy way to fix this error? What does the environment variable need to be called and what should the value be?

Thanks for any help,
Jeremy.

Developer technologies C#
{count} votes

2 answers

Sort by: Most helpful
  1. P a u l 10,761 Reputation points
    2022-01-31T20:20:46.033+00:00

    Rather than creating a new environment variable try adding the folder that contains your dotnet.exe (e.g. C:\Program Files\dotnet) in the existing Path variable. Once you've added it make sure you restart VS Code and then it should be usable.


  2. Karen Payne MVP 35,586 Reputation points Volunteer Moderator
    2022-01-31T21:08:03.15+00:00

    Under Environment Variables, see if you have DOTNET_HOST_PATH

    170006-figure1.png


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.