.NET Core + Mono Side-by-Side: 'Microsoft.NET.Sdk' specified could not be found.
See original GitHub issueI’m running into the common The SDK 'Microsoft.NET.Sdk' specified could not be found
error on Arch Linux (Manjaro) - the same error apparently as #3287, #3160, #2356, #2937, and others.
I suspect my case is different. I worked on a .NET Core game for a while, then installed godot-mono
, which includes Mono; when I came back to .NET Core, I get this error.
I suspect that VS Code finds the Mono runtime/SDK first, and then says “whelp there’s no .NET Core SDK installed for that” and fails hard. I hesitate to uninstall Godot and verify that this works, because I really do need both working side-by-side.
Is this an impossible/unsupported configuration?
OmniSharp log
OmniSharp server started with Mono 6.0.0.
Path: /home/nightblade/.vscode/extensions/ms-vscode.csharp-1.21.3/.omnisharp/1.34.3/omnisharp/OmniSharp.exe
PID: 8134
[info]: OmniSharp.Stdio.Host
Starting OmniSharp on manjaro 0.0 (x64)
[info]: OmniSharp.Services.DotNetCliService
DotNetPath set to dotnet
[warn]: OmniSharp.MSBuild.Discovery.Providers.MonoInstanceProvider
It looks like you have Mono 5.2.0 or greater installed but MSBuild could not be found.
Try installing MSBuild into Mono (e.g. 'sudo apt-get install msbuild') to enable better MSBuild support.
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
Located 1 MSBuild instance(s)
1: StandAlone 16.0 - "/home/nightblade/.vscode/extensions/ms-vscode.csharp-1.21.3/.omnisharp/1.34.3/omnisharp/.msbuild/Current/Bin"
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
MSBUILD_EXE_PATH environment variable set to '/home/nightblade/.vscode/extensions/ms-vscode.csharp-1.21.3/.omnisharp/1.34.3/omnisharp/.msbuild/Current/Bin/MSBuild.dll'
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
Registered MSBuild instance: StandAlone 16.0 - "/home/nightblade/.vscode/extensions/ms-vscode.csharp-1.21.3/.omnisharp/1.34.3/omnisharp/.msbuild/Current/Bin"
CscToolExe = csc.exe
TargetFrameworkRootPath = /usr/lib/mono/xbuild-frameworks
MSBuildToolsPath = /home/nightblade/.vscode/extensions/ms-vscode.csharp-1.21.3/.omnisharp/1.34.3/omnisharp/.msbuild/Current/Bin
CscToolPath = /home/nightblade/.vscode/extensions/ms-vscode.csharp-1.21.3/.omnisharp/1.34.3/omnisharp/.msbuild/Current/Bin/Roslyn
BypassFrameworkInstallChecks = true
MSBuildExtensionsPath = /usr/lib/mono/xbuild
[info]: OmniSharp.Cake.CakeProjectSystem
Detecting Cake files in '/home/nightblade/code/ali-the-android'.
[info]: OmniSharp.Cake.CakeProjectSystem
Could not find any Cake files
[info]: OmniSharp.MSBuild.ProjectSystem
Detecting projects in '/home/nightblade/code/ali-the-android/AliTheAndroid.sln'.
[info]: OmniSharp.MSBuild.ProjectManager
Queue project update for '/home/nightblade/code/ali-the-android/AliTheAndroid/AliTheAndroid.csproj'
[info]: OmniSharp.MSBuild.ProjectManager
Queue project update for '/home/nightblade/code/ali-the-android/AliTheAndroid.Tests/AliTheAndroid.Tests.csproj'
[info]: OmniSharp.Script.ScriptProjectSystem
Detecting CSX files in '/home/nightblade/code/ali-the-android'.
[info]: OmniSharp.Script.ScriptProjectSystem
Could not find any CSX files
[info]: OmniSharp.WorkspaceInitializer
Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpFormattingWorkspaceOptionsProvider, Order: 0
[info]: OmniSharp.MSBuild.ProjectManager
Loading project: /home/nightblade/code/ali-the-android/AliTheAndroid/AliTheAndroid.csproj
[info]: OmniSharp.WorkspaceInitializer
Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.RenameWorkspaceOptionsProvider, Order: 100
[info]: OmniSharp.WorkspaceInitializer
Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.EditorConfigWorkspaceOptionsProvider, Order: 200
[info]: OmniSharp.WorkspaceInitializer
Configuration finished.
[info]: OmniSharp.Stdio.Host
Omnisharp server running using Stdio at location '/home/nightblade/code/ali-the-android' on host 8000.
[warn]: OmniSharp.MSBuild.ProjectManager
Failed to load project file '/home/nightblade/code/ali-the-android/AliTheAndroid/AliTheAndroid.csproj'.
/home/nightblade/code/ali-the-android/AliTheAndroid/AliTheAndroid.csproj(1,1)
Microsoft.Build.Exceptions.InvalidProjectFileException: The SDK 'Microsoft.NET.Sdk' specified could not be found. /home/nightblade/code/ali-the-android/AliTheAndroid/AliTheAndroid.csproj
Environment information
VSCode version: 1.38.1 C# Extension: 1.21.3
Mono Information
OmniSharp using global mono :6.0.0Dotnet Information
.NET Core SDK (reflecting any global.json): Version: 2.2.108 Commit: 33ed5b90ceRuntime Environment:
OS Name: manjaro
OS Version:
OS Platform: Linux
RID: arch-x64
Base Path: /opt/dotnet/sdk/2.2.108/
Host (useful for support): Version: 2.2.6 Commit: 7dac9b1b51
.NET Core SDKs installed: 2.2.108 [/opt/dotnet/sdk]
.NET Core runtimes installed: Microsoft.NETCore.App 2.2.6 [/opt/dotnet/shared/Microsoft.NETCore.App]
To install additional .NET Core runtimes or SDKs: https://aka.ms/dotnet-download
Visual Studio Code Extensions
Extension | Author | Version |
---|---|---|
csharp | ms-vscode | 1.21.3 |
godot-tools | geequlim | 0.3.7 |
mono-debug | ms-vscode | 0.15.8 |
python | ms-python | 2019.9.34911 |
vscode-nxunit-test-adapter | wghats | 0.1.2 |
vscode-test-explorer | hbenl | 2.14.6 |
Issue Analytics
- State:
- Created 4 years ago
- Comments:14
Top GitHub Comments
Microsoft.Build.Exceptions.InvalidProjectFileException: The SDK ‘Microsoft.NET.Sdk’ specified could not be found. /home/nightblade/code/ali-the-android/AliTheAndroid/AliTheAndroid.csproj
PLS ADD THE FILE:
omnisharp.json :
{ “MSBuild”: { “UseLegacySdkResolver”: true } }
https://github.com/OmniSharp/omnisharp-vscode/issues/3287#issuecomment-536180721
I’ve run into this issue with Manjaro Linux fully updated (Arch based). I’ve MonoDevelop installed, working fine with Mono. I wanted to try dotnet core, so I downloaded & installed & created the expected symbols in .bashrc. These are the last two lines.
…which seem to work fine:
I can create a hello world dotnet application with:
Since I wanted to try Visual Studio Code and .NET Core, I installed Visual Studio Code:
$ yay -S visual-studio-code-bin
… which worked flawlessly. The problem is when I try to open the folder of the app HelloApp created before, then OmniSharp steps in and fails.I’ve looked for a solution in the form of a framework selector or “PATH to dotnet” or similar configuration, unfortunately to no avail. Since OmniSharp’s output suggest to install msbuild for Linux, I also tried that, uninstalled the extension and installed it back again. Unofrtunately, that did not solve anything.