question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

.NET Core + Mono Side-by-Side: 'Microsoft.NET.Sdk' specified could not be found.

See original GitHub issue

I’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.0
Dotnet Information .NET Core SDK (reflecting any global.json): Version: 2.2.108 Commit: 33ed5b90ce

Runtime 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:open
  • Created 4 years ago
  • Comments:14

github_iconTop GitHub Comments

3reactions
kinglionszcommented, Sep 30, 2019

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

1reaction
Baltasarqcommented, Sep 30, 2019

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.

export DOTNET_ROOT=$HOME/bin/dotnet
export PATH=$PATH:$HOME/bin/dotnet

…which seem to work fine:

$ echo $DOTNET_ROOT
/home/baltasarq/bin/dotnet
$ echo $PATH
/home/baltasarq/bin/google-cloud-sdk/bin:/home/baltasarq/.local/bin:/home/baltasarq/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/home/baltasarq/.local/share/flatpak/exports/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/home/baltasarq/.local/share/flatpak/exports/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/home/baltasarq/bin/node/bin:/home/baltasarq/bin/dotnet:/home/baltasarq/bin/node/bin:/home/baltasarq/bin/dotnet

$ dotnet --info
.NET Core SDK (reflecting any global.json):
 Version:   3.0.100
 Commit:    04339c3a26

Runtime Environment:
 OS Name:     manjaro
 OS Version:  
 OS Platform: Linux
 RID:         linux-x64
 Base Path:   /home/baltasarq/bin/dotnet/sdk/3.0.100/

Host (useful for support):
  Version: 3.0.0
  Commit:  7d57652f33

.NET Core SDKs installed:
  3.0.100 [/home/baltasarq/bin/dotnet/sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.App 3.0.0 [/home/baltasarq/bin/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 3.0.0 [/home/baltasarq/bin/dotnet/shared/Microsoft.NETCore.App]

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

I can create a hello world dotnet application with:

$ dotnet new console --name HelloApp
$ cd HelloApp
$ dotnet run
Hello World!

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.

OmniSharp server started with Mono 6.0.0.
    Path: /home/baltasarq/.vscode/extensions/ms-vscode.csharp-1.21.3/.omnisharp/1.34.3/omnisharp/OmniSharp.exe
    PID: 26562

[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/baltasarq/.vscode/extensions/ms-vscode.csharp-1.21.3/.omnisharp/1.34.3/omnisharp/.msbuild/Current/Bin"
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Registered MSBuild instance: StandAlone 16.0 - "/home/baltasarq/.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/baltasarq/.vscode/extensions/ms-vscode.csharp-1.21.3/.omnisharp/1.34.3/omnisharp/.msbuild/Current/Bin
            CscToolPath = /home/baltasarq/.vscode/extensions/ms-vscode.csharp-1.21.3/.omnisharp/1.34.3/omnisharp/.msbuild/Current/Bin/Roslyn
            BypassFrameworkInstallChecks = true
            MSBuildExtensionsPath = /usr/lib/mono/xbuild
Microsoft.Build.Exceptions.InvalidProjectFileException: The SDK 'Microsoft.NET.Sdk' specified could not be found.  /home/baltasarq/tmp/HelloApp/HelloApp.csproj
[fail]: OmniSharp.MSBuild.ProjectManager
        Attempted to update project that is not loaded: /home/baltasarq/tmp/HelloApp/HelloApp.csproj

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

MSBUILD throws error: The SDK 'Microsoft.NET.Sdk' specified ...
Sdk ' specified could not be found. The version of msbuild is the latest from microsoft visual studio 2017 tools. I'm using Windows...
Read more >
The SDK 'Microsoft.Net.Sdk.Web' specified could not be found
This article describes how to fix "The SDK 'Microsoft.Net.Sdk.Web' specified could not be found" when creating ASP.NET Core 2.0 projects in ...
Read more >
The SDK 'Microsoft.NET.Sdk.Web' specified could not be found
I was using asp.net core version 2.0.6 version and the application was running fine on that version , then I
Read more >
.NET core vs .NET framework - Stackify
NET Core is used to create server applications that run on Windows, Linux and Mac. It does not currently support creating desktop applications ......
Read more >
.NET - ArchWiki
4.3Error MSB4019: The imported project "/usr/share/dotnet/sdk/.../Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.Common.targets" was not found ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found