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.

The .NET Core SDK cannot be located when it's installed as a snap with dotnet-sdk.

See original GitHub issue

Issue Description

The .NET Core SDK cannot be located when it’s installed as a snap

Steps to Reproduce

  1. Install dotnet-sdk
sudo snap install dotnet-sdk
  1. Open VSCode

Expected Behavior

The extension should work.

Actual Behavior

The extension doesn’t work.

Logs

The .NET Core SDK cannot be located. .NET Core debugging will not be enabled. Make sure the .NET Core SDK is installed and is on the path.

OmniSharp log

Starting OmniSharp server at 2020-01-10, 11:31:19 a.m. Target: /home/gendnat/Code/bitbucket.org/groupecmi/gri-ms-vacation/Vacation.sln

OmniSharp server started. Path: /home/gendnat/.vscode-insiders/extensions/ms-vscode.csharp-1.21.9/.omnisharp/1.34.9/run PID: 17803

    Starting OmniSharp on ubuntu 19.10 (x64)
    DotNetPath set to dotnet
    Located 1 MSBuild instance(s)
        1: StandAlone 16.3 - "/home/gendnat/.vscode-insiders/extensions/ms-vscode.csharp-1.21.9/.omnisharp/1.34.9/omnisharp/.msbuild/Current/Bin"
    MSBUILD_EXE_PATH environment variable set to '/home/gendnat/.vscode-insiders/extensions/ms-vscode.csharp-1.21.9/.omnisharp/1.34.9/omnisharp/.msbuild/Current/Bin/MSBuild.dll'
    Registered MSBuild instance: StandAlone 16.3 - "/home/gendnat/.vscode-insiders/extensions/ms-vscode.csharp-1.21.9/.omnisharp/1.34.9/omnisharp/.msbuild/Current/Bin"
        CscToolExe = csc.exe
        MSBuildToolsPath = /home/gendnat/.vscode-insiders/extensions/ms-vscode.csharp-1.21.9/.omnisharp/1.34.9/omnisharp/.msbuild/Current/Bin
        CscToolPath = /home/gendnat/.vscode-insiders/extensions/ms-vscode.csharp-1.21.9/.omnisharp/1.34.9/omnisharp/.msbuild/Current/Bin/Roslyn
        BypassFrameworkInstallChecks = true
        MSBuildExtensionsPath = /home/gendnat/.vscode-insiders/extensions/ms-vscode.csharp-1.21.9/.omnisharp/1.34.9/omnisharp/.msbuild
    Detecting Cake files in '/home/gendnat/Code/bitbucket.org/groupecmi/gri-ms-vacation'.
    Could not find any Cake files
    Detecting projects in '/home/gendnat/Code/bitbucket.org/groupecmi/gri-ms-vacation/Vacation.sln'.
    Queue project update for '/home/gendnat/Code/bitbucket.org/groupecmi/gri-ms-vacation/Vacation/Vacation.csproj'
    Detecting CSX files in '/home/gendnat/Code/bitbucket.org/groupecmi/gri-ms-vacation'.
    Could not find any CSX files
    Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpFormattingWorkspaceOptionsProvider, Order: 0
    Loading project: /home/gendnat/Code/bitbucket.org/groupecmi/gri-ms-vacation/Vacation/Vacation.csproj
    Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.RenameWorkspaceOptionsProvider, Order: 100
    Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.EditorConfigWorkspaceOptionsProvider, Order: 200
    Configuration finished.
    Omnisharp server running using Stdio at location '/home/gendnat/Code/bitbucket.org/groupecmi/gri-ms-vacation' on host 17658.

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 [warn]: OmniSharp.MSBuild.ProjectManager Failed to load project file ‘/home/gendnat/Code/bitbucket.org/groupecmi/gri-ms-vacation/Vacation/Vacation.csproj’. /home/gendnat/Code/bitbucket.org/groupecmi/gri-ms-vacation/Vacation/Vacation.csproj(1,1) Microsoft.Build.Exceptions.InvalidProjectFileException: The SDK ‘Microsoft.NET.Sdk.Web’ specified could not be found. /home/gendnat/Code/bitbucket.org/groupecmi/gri-ms-vacation/Vacation/Vacation.csproj at Microsoft.Build.Shared.ProjectErrorUtilities.ThrowInvalidProject (System.String errorSubCategoryResourceName, Microsoft.Build.Shared.IElementLocation elementLocation, System.String resourceName, System.Object[] args) [0x00040] in <b695b16788dd418cbe8b4d98f7a92ff3>:0 at Microsoft.Build.Shared.ProjectErrorUtilities.VerifyThrowInvalidProject[T1] (System.Boolean condition, System.String errorSubCategoryResourceName, Microsoft.Build.Shared.IElementLocation elementLocation, System.String resourceName, T1 arg0) [0x00003] in <b695b16788dd418cbe8b4d98f7a92ff3>:0 at Microsoft.Build.Shared.ProjectErrorUtilities.ThrowInvalidProject[T1] (Microsoft.Build.Shared.IElementLocation elementLocation, System.String resourceName, T1 arg0) [0x00000] in <b695b16788dd418cbe8b4d98f7a92ff3>:0 at Microsoft.Build.Evaluation.Evaluator4[P,I,M,D].ExpandAndLoadImportsFromUnescapedImportExpressionConditioned (System.String directoryOfImportingFile, Microsoft.Build.Construction.ProjectImportElement importElement, System.Collections.Generic.List1[Microsoft.Build.Construction.ProjectRootElement]& projects, Microsoft.Build.BackEnd.SdkResolution.SdkResult& sdkResult, System.Boolean throwOnFileNotExistsError) [0x00254] in <b695b16788dd418cbe8b4d98f7a92ff3>:0 at Microsoft.Build.Evaluation.Evaluator4[P,I,M,D].ExpandAndLoadImports (System.String directoryOfImportingFile, Microsoft.Build.Construction.ProjectImportElement importElement, Microsoft.Build.BackEnd.SdkResolution.SdkResult& sdkResult) [0x00027] in <b695b16788dd418cbe8b4d98f7a92ff3>:0 at Microsoft.Build.Evaluation.Evaluator4[P,I,M,D].EvaluateImportElement (System.String directoryOfImportingFile, Microsoft.Build.Construction.ProjectImportElement importElement) [0x0000d] in <b695b16788dd418cbe8b4d98f7a92ff3>:0 at Microsoft.Build.Evaluation.Evaluator4[P,I,M,D].PerformDepthFirstPass (Microsoft.Build.Construction.ProjectRootElement currentProjectOrImport) [0x000e6] in <b695b16788dd418cbe8b4d98f7a92ff3>:0 at Microsoft.Build.Evaluation.Evaluator4[P,I,M,D].Evaluate (Microsoft.Build.BackEnd.Logging.ILoggingService loggingService, Microsoft.Build.Framework.BuildEventContext buildEventContext) [0x0011c] in <b695b16788dd418cbe8b4d98f7a92ff3>:0 at Microsoft.Build.Evaluation.Evaluator4[P,I,M,D].Evaluate (Microsoft.Build.Evaluation.IEvaluatorData4[P,I,M,D] data, Microsoft.Build.Construction.ProjectRootElement root, Microsoft.Build.Evaluation.ProjectLoadSettings loadSettings, System.Int32 maxNodeCount, Microsoft.Build.Collections.PropertyDictionary1[T] environmentProperties, Microsoft.Build.BackEnd.Logging.ILoggingService loggingService, Microsoft.Build.Evaluation.IItemFactory2[S,T] itemFactory, Microsoft.Build.Evaluation.IToolsetProvider toolsetProvider, Microsoft.Build.Evaluation.ProjectRootElementCache projectRootElementCache, Microsoft.Build.Framework.BuildEventContext buildEventContext, Microsoft.Build.BackEnd.SdkResolution.ISdkResolverService sdkResolverService, System.Int32 submissionId, Microsoft.Build.Evaluation.Context.EvaluationContext evaluationContext, System.Boolean interactive) [0x0002f] in <b695b16788dd418cbe8b4d98f7a92ff3>:0 at Microsoft.Build.Evaluation.Project.Reevaluate (Microsoft.Build.BackEnd.Logging.ILoggingService loggingServiceForEvaluation, Microsoft.Build.Evaluation.ProjectLoadSettings loadSettings, Microsoft.Build.Evaluation.Context.EvaluationContext evaluationContext) [0x0005e] in <b695b16788dd418cbe8b4d98f7a92ff3>:0 at Microsoft.Build.Evaluation.Project.ReevaluateIfNecessary (Microsoft.Build.BackEnd.Logging.ILoggingService loggingServiceForEvaluation, Microsoft.Build.Evaluation.ProjectLoadSettings loadSettings, Microsoft.Build.Evaluation.Context.EvaluationContext evaluationContext) [0x00035] in <b695b16788dd418cbe8b4d98f7a92ff3>:0 at Microsoft.Build.Evaluation.Project.ReevaluateIfNecessary (Microsoft.Build.BackEnd.Logging.ILoggingService loggingServiceForEvaluation, Microsoft.Build.Evaluation.Context.EvaluationContext evaluationContext) [0x00000] in <b695b16788dd418cbe8b4d98f7a92ff3>:0 at Microsoft.Build.Evaluation.Project.ReevaluateIfNecessary (Microsoft.Build.Evaluation.Context.EvaluationContext evaluationContext) [0x00007] in <b695b16788dd418cbe8b4d98f7a92ff3>:0 at Microsoft.Build.Evaluation.Project.Initialize (System.Collections.Generic.IDictionary2[TKey,TValue] globalProperties, System.String toolsVersion, System.String subToolsetVersion, Microsoft.Build.Evaluation.ProjectLoadSettings loadSettings, Microsoft.Build.Evaluation.Context.EvaluationContext evaluationContext) [0x00126] in <b695b16788dd418cbe8b4d98f7a92ff3>:0 at Microsoft.Build.Evaluation.Project..ctor (System.String projectFile, System.Collections.Generic.IDictionary2[TKey,TValue] globalProperties, System.String toolsVersion, System.String subToolsetVersion, Microsoft.Build.Evaluation.ProjectCollection projectCollection, Microsoft.Build.Evaluation.ProjectLoadSettings loadSettings, Microsoft.Build.Evaluation.Context.EvaluationContext evaluationContext) [0x00093] in <b695b16788dd418cbe8b4d98f7a92ff3>:0 at Microsoft.Build.Evaluation.Project…ctor (System.String projectFile, System.Collections.Generic.IDictionary2[TKey,TValue] globalProperties, System.String toolsVersion, System.String subToolsetVersion, Microsoft.Build.Evaluation.ProjectCollection projectCollection, Microsoft.Build.Evaluation.ProjectLoadSettings loadSettings) [0x00000] in <b695b16788dd418cbe8b4d98f7a92ff3>:0 at Microsoft.Build.Evaluation.Project..ctor (System.String projectFile, System.Collections.Generic.IDictionary2[TKey,TValue] globalProperties, System.String toolsVersion, Microsoft.Build.Evaluation.ProjectCollection projectCollection, Microsoft.Build.Evaluation.ProjectLoadSettings loadSettings) [0x00000] in <b695b16788dd418cbe8b4d98f7a92ff3>:0 at Microsoft.Build.Evaluation.Project…ctor (System.String projectFile, System.Collections.Generic.IDictionary2[TKey,TValue] globalProperties, System.String toolsVersion, Microsoft.Build.Evaluation.ProjectCollection projectCollection) [0x00000] in <b695b16788dd418cbe8b4d98f7a92ff3>:0 at Microsoft.Build.Evaluation.ProjectCollection.LoadProject (System.String fileName, System.Collections.Generic.IDictionary2[TKey,TValue] globalProperties, System.String toolsVersion) [0x000f7] in <b695b16788dd418cbe8b4d98f7a92ff3>:0 at Microsoft.Build.Evaluation.ProjectCollection.LoadProject (System.String fileName, System.String toolsVersion) [0x00000] in <b695b16788dd418cbe8b4d98f7a92ff3>:0 at OmniSharp.MSBuild.ProjectLoader.EvaluateProjectFileCore (System.String filePath) [0x0003f] in <1e840ade9fdb41e3ae5c236a4f4a1c58>:0 at OmniSharp.MSBuild.ProjectLoader.BuildProject (System.String filePath) [0x0000d] in <1e840ade9fdb41e3ae5c236a4f4a1c58>:0 at OmniSharp.MSBuild.ProjectFile.ProjectFileInfo.Load (System.String filePath, OmniSharp.MSBuild.ProjectIdInfo projectIdInfo, OmniSharp.MSBuild.ProjectLoader loader) [0x00015] in <1e840ade9fdb41e3ae5c236a4f4a1c58>:0 at OmniSharp.MSBuild.ProjectManager+<>c__DisplayClass29_0.<LoadProject>b__0 () [0x00000] in <1e840ade9fdb41e3ae5c236a4f4a1c58>:0 at (wrapper delegate-invoke) System.Func1[System.ValueTuple3[OmniSharp.MSBuild.ProjectFile.ProjectFileInfo,System.Collections.Immutable.ImmutableArray1[OmniSharp.MSBuild.Logging.MSBuildDiagnostic],OmniSharp.MSBuild.Notification.ProjectLoadedEventArgs]].invoke_TResult() at OmniSharp.MSBuild.ProjectManager.LoadOrReloadProject (System.String projectFilePath, System.Func1[TResult] loader) [0x0001b] in <1e840ade9fdb41e3ae5c236a4f4a1c58>:0

    Attempted to update project that is not loaded: /home/gendnat/Code/bitbucket.org/groupecmi/gri-ms-vacation/Vacation/Vacation.csproj

C# log

Failed to spawn ‘dotnet --info’

Environment information

VSCode version: 1.42.0-insider C# Extension: 1.21.9

Mono Information OmniSharp using built-in mono
Dotnet Information A valid dotnet installation could not be found.
Visual Studio Code Extensions
Extension Author Version
Angular2 johnpapa 8.3.0
beautify HookyQR 1.5.0
code-settings-sync Shan 3.4.3
csharp ms-vscode 1.21.9
dart-code Dart-Code 3.7.1
datapack-helper pca 0.6.1
debugger-for-chrome msjsdiag 4.12.4
debugger-for-edge msjsdiag 1.0.13
discord-vscode icrawl 3.13.0
docs-yaml docsmsft 0.2.4
dotenv mikestead 1.0.1
EditorConfig EditorConfig 0.14.4
git-project-manager felipecaputo 1.7.1
githistory donjayamanne 0.4.13
gitlens eamodio 10.2.0
Go ms-vscode 0.12.0
gradle-language naco-siren 0.2.3
jbockle-format-files jbockle 3.0.0
jenkinsfile-support ivory-lab 0.4.4
jshint dbaeumer 0.10.21
language-mcfunction arcensoth 0.16.0
markdown-pdf yzane 1.4.1
mssql ms-mssql 1.8.0
mustache dawhite 1.1.1
ng-template Angular 0.900.4
npm-intellisense christian-kohler 1.3.0
output-colorizer IBM 0.1.2
path-intellisense christian-kohler 1.4.2
php-cs-fixer junstyle 0.1.129
polacode pnp 0.3.4
python ms-python 2020.1.57204
read-time johnpapa 0.2.0
sqltools mtxr 0.21.6
systemd-unit-file coolbear 1.0.6
typescript-javascript-grammar ms-vscode 0.0.53
vscode-docker ms-azuretools 0.9.0
vscode-edge-devtools ms-edgedevtools 1.0.6
vscode-firefox-debug firefox-devtools 2.6.1
vscode-markdownlint DavidAnson 0.33.0
vscode-npm-script eg2 0.3.10
vscode-react-native msjsdiag 0.13.2
vscode-typescript-next ms-vscode 3.8.20200109
vscode-typescript-tslint-plugin ms-vscode 1.2.3
vscode-yaml redhat 0.6.1
vscodeintellicode VisualStudioExptTeam 1.2.2
vsliveshare ms-vsliveshare 1.0.1456
xml DotJoshJohnson 2.5.0

Now that all those tools aren’t able to output dotnet --info, let me just print that command real quick.

.NET Core SDK (reflecting any global.json):
 Version:   3.1.100
 Commit:    cd82f021f4

Runtime Environment:
 OS Name:     ubuntu
 OS Version:  19.10
 OS Platform: Linux
 RID:         ubuntu.19.10-x64
 Base Path:   /snap/dotnet-sdk/57/sdk/3.1.100/

Host (useful for support):
  Version: 3.1.0
  Commit:  65f04fb6db

.NET Core SDKs installed:
  3.1.100 [/snap/dotnet-sdk/57/sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.App 3.1.0 [/snap/dotnet-sdk/57/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 3.1.0 [/snap/dotnet-sdk/57/shared/Microsoft.NETCore.App]

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

Part of the problem is that dotnet-sdk will expose the command as dotnet-sdk.dotnet instead of dotnet. /snap/dotnet-sdk/current/ can be added to $PATH as a workaround, but then you lose auto-completion, so it’s not a valid solution.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:5
  • Comments:11 (5 by maintainers)

github_iconTop GitHub Comments

10reactions
sberneycommented, Aug 7, 2020

None of these fixes did the trick for me. I guess I won’t develop C# on Ubuntu.

4reactions
JoeRobichcommented, Aug 7, 2020

@sberney Since there is obviously a lot of extra configuration required to get a working install with Snap. It may be simpler to use APT instead. https://docs.microsoft.com/en-us/dotnet/core/install/linux#ubuntu & https://docs.microsoft.com/en-us/dotnet/core/install/linux-ubuntu

Read more comments on GitHub >

github_iconTop Results From Across the Web

The .NET Core SDK cannot be located. .NET Core debugging ...
I have the 5.0.103 [/snap/dotnet-sdk/112/sdk] installed (as shown, using snap) on KDE neon (based on Ubuntu 20.04).
Read more >
Getting .NET Core SDK not located error when I open a script ...
However, there are a few issues with snap installation. Installing dotnet through APT worked for me without a reboot. Dotnet SDK Ubuntu.
Read more >
How to Fix The .NET Core SDK cannot be located ... - YouTube
Today we will fix the . NET Core missing problem of Visual Studio Code. It happened when we installed C# Extension on Visual...
Read more >
Error during C# set up on Visual Studio: The .NET Core SDK ...
NET Core SDK cannot be located. .NET Core debugging ... NET Core SDK is installed and is on the path. [SOLVED]. Hi there,...
Read more >
Can not compile .net core 3.0 projects - Visual Studio Feedback
Can not compile .net core 3.0 projects although the x64 SDK is installed. ... 1>C:\Program Files\dotnet\sdk\2.2.402\Sdks\Microsoft.NET.Sdk\targets\Microsoft ...
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