Omnisharp-vscode: Arch Linux: "The SDK 'Microsoft.Net.Sdk' specified could not be found."

Created on 26 Jan 2019  路  11Comments  路  Source: OmniSharp/omnisharp-vscode

Environment data

dotnet --info output:

.NET Core SDK (reflecting any global.json):
 Version:   2.2.102
 Commit:    96ff75a873

Runtime Environment:
 OS Name:     arch
 OS Version:  
 OS Platform: Linux
 RID:         arch-x64
 Base Path:   /opt/dotnet/sdk/2.2.102/

Host (useful for support):
  Version: 2.2.1
  Commit:  878dd11e62

.NET Core SDKs installed:
  2.2.102 [/opt/dotnet/sdk]

.NET Core runtimes installed:
  Microsoft.NETCore.App 2.2.1 [/opt/dotnet/shared/Microsoft.NETCore.App]

To install additional .NET Core runtimes or SDKs:
  https://aka.ms/dotnet-download

VS Code version:

1.30.2

C# Extension version:

1.17.1

Steps to reproduce

Create new console project using dotnet new console, open VSCode either via start menu or command line.

Expected behavior

Projects loads fine

Actual behavior

Omnisharp loads and displays the mentioned issue above.

Workaround

I found at least a workaround to fix this issue when opening VSCode via command line.
Unfortunately I haven't yet found a way to solve it when starting via start menu.

Fix:

  • add environment variable MSBuildSDKsPath=/opt/dotnet/sdk/2.2.102/Sdks
  • open project file, replace <Project Sdk="Microsoft.Net.Sdk"> with <Project Sdk="Microsoft.NET.Sdk"> (uppercased Net)

I'm using Arch Linux with KDE, pretty clean/new system.
Used latest Ubuntu before, no problems at all.

Although the workaround works for now, I guess it will break everytime a different SDK version gets used.

.Net sdk not found Bug

Most helpful comment

Create the file /etc/profile.d/dotnet.sh

export DOTNET_ROOT=/opt/dotnet
export MSBuildSDKsPath=$DOTNET_ROOT/sdk/$(${DOTNET_ROOT}/dotnet --version)/Sdks
export PATH=${PATH}:${DOTNET_ROOT}

Found here: https://bugs.archlinux.org/task/60903?project=5&string=dotnet-host

All 11 comments

Create the file /etc/profile.d/dotnet.sh

export DOTNET_ROOT=/opt/dotnet
export MSBuildSDKsPath=$DOTNET_ROOT/sdk/$(${DOTNET_ROOT}/dotnet --version)/Sdks
export PATH=${PATH}:${DOTNET_ROOT}

Found here: https://bugs.archlinux.org/task/60903?project=5&string=dotnet-host

Same thing happens to me on Solus. I created an Arch Linux VM to test if it still occurs, and it does - looks exactly the same.

  1. There is the "no SDKs" error described in the issue, setting MSBuildSDKsPath fixed the issue.
  2. If DOTNET_ROOT is set, the Razor server crashes. I tried to find the root of the issue, but even the verbose mode did not show me anything. I just disabled it.
  3. Even with all that solved, everything still doesn't work completely. If I go to debug menu and press play, I get the task build and then the console. On my Fedora installation, there was a lot of output, but here I just get the "You may only use Microsoft .NET Core Debugger (vsdbg) with..." on the console, nothing happens and the debug bar disappears.

@nickelghost Did you install the official Microsoft VS Code from https://code.visualstudio.com/? Debugging is only supported in the official version (not the open source version).

Unfortunately, VS Code seems to have broken the reporting for the error that the debugger sends back about this.

@gregg-miskelly I'm using the version from my distro's repository, so I guess it's the unofficial version. How come debugging is disabled on the open source version? I thought Microsoft <3 Open Source...

The debugger is considered part of Visual Studio, so it is only licensed to run in official Microsoft products.

@gregg-miskelly Is it open source then but under a different license? Or is it a closed source part of Microsoft's build?
If it is open, is there a way to get it working with the open vscode?

The debugger is closed source.

I had this exact same issue. Was using the visual studio code from AUR on my computer (Manjaro) and the error kept coming up. However, @virtualdreams solution fixed it.

The issue is being tracked in dotnet/cli#12110.

Was this page helpful?
1 / 5 - 1 ratings