VS Code: The .NET SDK cannot be located (steamOS)
I am attempting to use a steam deck game dev with unity and VS code gave this error one day. I DO have .net sdk installed and it is set to PATH. I have tried uninstalling C# extentions and re installing. As well as removing dotnet from this computer and re installing. Nothing as worked.
full error:
The .NET SDK cannot be located: Error running dotnet --info: Error: Command failed: dotnet --info
/bin/sh: line 1: dotnet: command not found
/bin/sh: line 1: dotnet: command not found
. .NET debugging will not be enabled. Make sure the .NET SDK is installed and is on the path.
32 Replies
What does
dotnet info and dotnet --list-sdks output?it outputs normally, says version is 10.0 and gives directory
$dotnetpath
* Open
powershell in a terminal in admin mode as in the following video:
https://cdn.discordapp.com/attachments/569261465463160900/1157744344183341156/20230930-1822-10.7436061.mp4
* copy/paste the following script:
in case of an invalid setup detected, it will:
* tell you that it did (or not) detected an invalid Path setup
* in case some action are require it will ask you to Press Enter to confirmTry this
Though...
No, sorry, this is for Windows
How did you install .NET? Via package manager or official MS script?
it also could be good if you relaunch your bash profile
it was the scripting methodon the ms website
try
. ~/.bashrc in the terminal you are experiencing an issue
or open another terminal
does it help?i opned another terminal and i still get the same issue but dotnet is on the path
can you try
which dotnetreturns /home/deck/.dotnet/dotnet
can you try
/home/deck/.dotnet/dotnet run command on you solution?it gives the sdk version and then gives and error : Couldn't find a project to run. Ensure a project exists in /home/deck, or pass the path to the project using --project.
you have to run it inside directory where your
.csproj file placed, or specify it with argumentI've had the same problem and running "code" from the terminal "solved" it
if this command does work - it's definitely something wrong with your path variable
so it outputs without internal errors - good sign
you just need to specify what project you need to run with
/home/deck/.dotnet/dotnet run /home/deck/Projects/MyCoolApp/MyCoolApp.csproj, where /home/deck/Projects/MyCoolApp/MyCoolApp.csproj is the path to your .csproj file
or you can run /home/deck/.dotnet/dotnet run on the same directory as your project
if you dont need to run project, then just change dotnet run ... command into dotnet build ...
@Dan ݁₊ ⊹ . ݁˖ . ݁ which terminal are you using when you get the error? Some terminal apps can override pathits the VScode pop up thats giving the error
try your system terminal to compile the project
or change terminal profile in vscode - you need to adjust it with the system one
sometimes restarting vscode helps to solve an issue - it will reload all your variables, configs, env and so on...
hey @DanTe, any updates?
oops, ping wrong person
@Dan ݁₊ ⊹ . ݁˖ . ݁
im sorry but like i cant find the csproj 😅
the folder only contains the project sln
you can type
pwd on your vscode terminal - it will output the working directory
you can inspect sln file and see to what projects and sub-directories it is pinnedlike this

(protip: migrate to
.slnx)I think Unity doesnt support new features
with slnx
Ah, yeah, if we're talking about Unity then forget about anything modern lmao
it would be funny if this si the thing tha tmakes me switch to godot
anyway, seems dotnet works fine if it outputs information. The problem is your vscode can not reed your path for some reason
but yes in the project file i just get like 20 unity csproj
Give Rider a shot, if VSC refuses to work?
or dotnet CLI (outside of vscode 😄)
will try thank you tho
There are open issues like https://github.com/microsoft/vscode-dotnettools/issues/2504 right now, so you might have to wait for Microsoft to fix and ship an update.
The workaround seems to be switching to a specific old release of the extension, or like other comment indicated another development tool.
i switch to rider and that works lol oh well