C
C#2y ago
Monkey

✅ VSCode error

When I type in the code "dotnet new console" it just gives me a error message when its supposed to create files in my folder that I selected. If your wondering yes I have the framework and sdk's installed
42 Replies
230V
230V2y ago
230V
230V2y ago
you can check that you don't have any SDK with dotnet --list-sdks
Monkey
MonkeyOP2y ago
it doesn't list anything
230V
230V2y ago
yup, so install an sdk
Monkey
MonkeyOP2y ago
then whats all those "sdks" i installed
230V
230V2y ago
<:PES2_Shrug:513352546341879808>
Monkey
MonkeyOP2y ago
230V
230V2y ago
oh have you restarted vscode?
Monkey
MonkeyOP2y ago
?
230V
230V2y ago
after installing the sdks, you might need to restart vscode because of environment variable stuff if that won't let you use dotnet new, maybe a computer restart is needed
Monkey
MonkeyOP2y ago
this may sound like a stupid question but how do you restart vsc
230V
230V2y ago
close it and open it again
Monkey
MonkeyOP2y ago
yeah did that still gives me the error message in the corner hold on ima restart still got the error in the terminal
230V
230V2y ago
what does set path output in the terminal? also check if dotnet --list-sdks is still empty
Monkey
MonkeyOP2y ago
nothing
230V
230V2y ago
pepewut where calc?
Monkey
MonkeyOP2y ago
230V
230V2y ago
change this to the normal command prompt
230V
230V2y ago
I cba to google how to see environment variables in powershell then try set path and dotnet --list-sdks
Monkey
MonkeyOP2y ago
C:\Users\taiya>set path Path=C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\WINDOWS\System32\OpenSSH;C:\Program Files\Git LFS;C:\Program Files (x86)\dotnet;C:\Program Files\dotnet;C:\Users\taiya\AppData\Local\Microsoft\WindowsApps;C:\Users\taiya.dotnet\tools;C:\Users\taiya\AppData\Local\Programs\Microsoft VS Code\bin PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC still nothing so yeah pretty stuck
ero
ero2y ago
Can you open the installed programs in control panel
Monkey
MonkeyOP2y ago
sure just gimme 20 mins i gotta do something
230V
230V2y ago
C:\Program Files (x86)\dotnet;C:\Program Files\dotnet you can't have both 32bit and 64bit versions in the path, but for some reason this keeps happening to people
ero
ero2y ago
that's exactly right
230V
230V2y ago
setx /M PATH "%PATH:C:\Program Files (x86)\dotnet;=%" might just work (requires admin)
230V
230V2y ago
this can also be done manually https://www.alphr.com/set-environment-variables-windows-11/ you need to edit Path, remove C:\Program Files (x86)\dotnet from it, click OK everywhere to save, you'll need to reopen vscode and dotnet --list-sdks should list the SDKs finally
Alphr
How To Set Environment Variables in
Windows uses environment variables to store information about a system, such as its processes and resource usage. Setting these variables means creating shortcuts that allow you to find data locations using a keyword instead of typing in the whole location
ero
ero2y ago
just uninstall the x86 versions
230V
230V2y ago
^if the 5 SDKs you shown on the screenshot are not the only ones you have
Monkey
MonkeyOP2y ago
alr im back thing is i only download the 64bit version of the sdks
230V
230V2y ago
the 32b path precedes the 64b one so dotnet is found in the 32b folder, executed and it finds no 32b SDKs, that's why you can't do anything
Monkey
MonkeyOP2y ago
so whats the solution exactly the one your just explained or the one im replying to
230V
230V2y ago
that
Monkey
MonkeyOP2y ago
and requires admin?
230V
230V2y ago
yes
Monkey
MonkeyOP2y ago
wdym by admin like how would i access command prompt with admin
230V
230V2y ago
Win+S, "cmd", "Run as administrator"
Monkey
MonkeyOP2y ago
oh like that nvm i thought you meant in another way
Monkey
MonkeyOP2y ago
this path?
Monkey
MonkeyOP2y ago
never mind found it les go
Monkey
MonkeyOP2y ago
230V
230V2y ago
nice
Monkey
MonkeyOP2y ago
oh bruh i thought i had to change it

Did you find this page helpful?