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
Angius
Angius2w ago
What does dotnet info and dotnet --list-sdks output?
Dan  ݁₊ ⊹ . ݁˖ . ݁
it outputs normally, says version is 10.0 and gives directory
Angius
Angius2w ago
$dotnetpath
MODiX
MODiX2w ago
* 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:
iex "& { $(irm https://gist.githubusercontent.com/tebeco/5c6cc0eee8c28fad3523008d58f83914/raw/d14890f540ae74ad72d950c48f6a242e9401d31e/fix-dotnet-path.ps1) }"
iex "& { $(irm https://gist.githubusercontent.com/tebeco/5c6cc0eee8c28fad3523008d58f83914/raw/d14890f540ae74ad72d950c48f6a242e9401d31e/fix-dotnet-path.ps1) }"
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 confirm
Angius
Angius2w ago
Try this Though... No, sorry, this is for Windows
kurumi
kurumi2w ago
How did you install .NET? Via package manager or official MS script? it also could be good if you relaunch your bash profile
Dan  ݁₊ ⊹ . ݁˖ . ݁
it was the scripting methodon the ms website
kurumi
kurumi2w ago
try . ~/.bashrc in the terminal you are experiencing an issue or open another terminal does it help?
Dan  ݁₊ ⊹ . ݁˖ . ݁
i opned another terminal and i still get the same issue but dotnet is on the path
kurumi
kurumi2w ago
can you try which dotnet
Dan  ݁₊ ⊹ . ݁˖ . ݁
returns /home/deck/.dotnet/dotnet
kurumi
kurumi2w ago
can you try /home/deck/.dotnet/dotnet run command on you solution?
Dan  ݁₊ ⊹ . ݁˖ . ݁
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.
kurumi
kurumi2w ago
you have to run it inside directory where your .csproj file placed, or specify it with argument
Bitcoder
Bitcoder2w ago
I've had the same problem and running "code" from the terminal "solved" it
kurumi
kurumi2w ago
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 path
Dan  ݁₊ ⊹ . ݁˖ . ݁
its the VScode pop up thats giving the error
kurumi
kurumi2w ago
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 ݁₊ ⊹ . ݁˖ . ݁
Dan  ݁₊ ⊹ . ݁˖ . ݁
im sorry but like i cant find the csproj 😅 the folder only contains the project sln
kurumi
kurumi2w ago
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 pinned
kurumi
kurumi2w ago
like this
No description
Angius
Angius2w ago
(protip: migrate to .slnx)
kurumi
kurumi2w ago
I think Unity doesnt support new features with slnx
Angius
Angius2w ago
Ah, yeah, if we're talking about Unity then forget about anything modern lmao
Dan  ݁₊ ⊹ . ݁˖ . ݁
it would be funny if this si the thing tha tmakes me switch to godot
kurumi
kurumi2w ago
anyway, seems dotnet works fine if it outputs information. The problem is your vscode can not reed your path for some reason
Dan  ݁₊ ⊹ . ݁˖ . ݁
but yes in the project file i just get like 20 unity csproj
Angius
Angius2w ago
Give Rider a shot, if VSC refuses to work?
kurumi
kurumi2w ago
or dotnet CLI (outside of vscode 😄)
Dan  ݁₊ ⊹ . ݁˖ . ݁
will try thank you tho
Lex Li
Lex Li2w ago
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.
Dan  ݁₊ ⊹ . ݁˖ . ݁
i switch to rider and that works lol oh well

Did you find this page helpful?