The .NET Core SDK cannot be located
Environment data
dotnet --info output:
It was not possible to find any installed .NET Core SDKs
Did you mean to run .NET Core SDK commands? Install a .NET Core SDK from:
https://aka.ms/dotnet-download
Host (useful for support): Version: 3.0.0 Commit: 95a0a61858
.NET Core SDKs installed: No SDKs were found.
.NET Core runtimes installed: Microsoft.NETCore.App 3.0.0 [C:\Program Files (x86)\dotnet\shared\Microsoft.NETCore.App] Microsoft.WindowsDesktop.App 3.0.0 [C:\Program Files (x86)\dotnet\shared\Microsoft.WindowsDesktop.App]
To install additional .NET Core runtimes or SDKs: https://aka.ms/dotnet-download
VS Code version: 1.40
C# Extension version: 1.21.6
Steps to reproduce
Expected behavior
VScode find .net core sdk
Actual behavior
VScode can't find .net core sdk but i installed it

Same thing when using 1.21.7
The net core 3.0-rc1 sdk works perfectly fine: https://dotnet.microsoft.com/download/thank-you/dotnet-sdk-3.0.100-rc1-windows-x64-installer
Failed to install
Please, don't install the 3.0-rc1 SDK -- that is an outdated release candidate.
@GhostShot3 the output you have from above indicates that the C# extension is working correctly - you don't have a .NET SDK installed, just a .NET runtime. Did you install an SDK? Here is the current install link from https://dotnet.microsoft.com/learn/dotnet/hello-world-tutorial/install
Yes i install i tryed and say already installed
Can you try uninstalling it and reinstalling it? I suspect something went wrong with the first install.
Worked, thank you
Just wanted to chime in and say I saw the same problem, with the same resolution.
In my case, I uninstalled several things (.NET Core 2.2.7, .NET Core 3.0, NuGet, Mono) and reinstalled just the .NET Core 3.0. That seemed to resolve the problem.
It looks like VSCode was picking up the MSBuild/etc. from the Mono folder (mine was Mono 6.0 for some reason), but anyway, reinstall for the win.
(I'm on Linux if that matters)
I have this problem when starting VSCodium with drun. Starting VSCodium from zsh and it works as expected.
Can anyone explain what the different in these two methods could be? Something related to paths I imagine.
Update: Actually, I do get what I expected from dotnet --info when running that in a terminal.
And if I have one instance of VSCodium open that I started from terminal. Any extra instances I open with drun now works.
Update 2: It was strictly a VSCodium issue, works fine in VSCode.
Environment
- .NET Core SDK
3.1 - VSCode C# Extension
1.21.9 - Mac
Reference
OmniSharp/omnisharp-vscode Wiki
If you had Visual Studio Code open at the time you installed the .NET SDK, and you haven't restarted it, you should do so.
My Solution
Exit VSCode and open it...
Reason
I try not to exit vscode on my mac when it's connected to a monitor because vscode has some GPU rendering problem in this circumstances. This habbit leads to the problems.
Please see https://dotnetresolutions.wordpress.com/2020/05/21/making-net-core-binaries-work-with-visual-studio-code
Also note, if you are installing .net sdk on a platform where we do not provide an installer or where you want to automate the installation. The dotnet-install script should configure everything necessary. https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-install-script
This issue pops up on Ubuntu 20.04 following both links above, when installing using APT, snap or the script cited. I can run which dotnet and verify the sdk binary is in PATH, but when opening vs code from the same terminal session using code . it still throws the errors around the missing SDK.
@JackTiber In case you haven't already read this: https://github.com/OmniSharp/omnisharp-vscode/wiki/Troubleshooting:-'The-.NET-Core-SDK-cannot-be-located.'-errors
This issue isn't a problem with this extension -- this is either a problem with VS Code, or with your shell. There is instructions in there on debugging VS Code if you are so inclined.
@gregg-miskelly thanks for the link! So oddly, that did help with VS Code popup regarding a missing SDK, but then in the actual output logs of the Omnisharp plugin's language server, it still fails to find an SDK binary to use. Originally, I had the sdk installed via APT, but most recently used SNAP to see if that worked.
At this point, I am going to do a full wipe of the machine and start from scratch, to also support a couple of hardware updates I am making. Will check back in either way, but definitely a lot of issues installing it on LTS versions of Ubuntu.
If there's still people having this issue then try this:
- From start menu search for "this pc", right click and select properties.
- Click Advanced system settings
- Click on "Environment Variables..."
- Select either the Users or Systems "Path" variable and click Edit...
- In either of them you should find the path to your "dotnet" folder
now in my case I had 2 C:\Program Files (x86)\dotnet\ and C:\Program Files\dotnet\ if you actually go to the folders you'll notice that there's no sdk folder within the C:\Program Files (x86)\dotnet\ folder. So simply select C:\Program Files\dotnet\ and click the "move up" button. Then click OK all the way out of there, now try and see if things are working..
I basically just had to restart my pc after installing the .NET sdk. Then it all worked! I guess some changes (env variables?) needed a reboot.
@JackTiber Where you able to solve your issue? I'm having the same problem and wondering if going nuclear is my only option at this point. Thanks.
@Drexlin I did. At the end of the day, the best method I found was to remove any trace of the SDK (snap especially which can have even more issues than installing via APT in the docs) and then re-installing using APT. Once it is installed, verify that you can get the binary on your path with which dotnet, but do not try to use it yet. Restart your machine, which I recommend actually shutting down completely and then bringing it back up. At that point, it started working for me.
The link @gregg-miskelly provided is pretty helpful in detailing the troubleshooting steps.
Honestly, if I had to guess this probably has something to do with where the binary is installed on Debian based systems and the spawned shell for the extension / VS Code, which is somehow why the restart makes a difference. Some environment variable that isn't set after installation is probably set during startup and fixes the issue. Recently worked with a Fedora 32 machine and had all of 0 problems getting the SDK installed and working with the extension and code.
@JackTiber Thanks, I will try that. If I can't get it to work, maybe I'll give CentOS a try.