Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The .NET Core SDK cannot be located: A valid dotnet installation could not be found. #6177

Closed
fuszenecker opened this issue Aug 19, 2023 · 2 comments
Assignees
Labels
.Net sdk not found These are a group of issues when the dotnet sdk could not be found Resolved-Not Reproducible
Milestone

Comments

@fuszenecker
Copy link

Type: Bug

Issue Description

The .NET Core SDK cannot be located: A valid dotnet installation could not be found. .NET Core debugging will not be enabled. Make sure the .NET Core SDK is installed and is on the path.

Even though my .NET SDK is installed perfectly.

Steps to Reproduce

Open VS Code from menu.

Expected Behavior

C# extension recognises .NET SDK and runs well.

Actual Behavior

Error popup appears.

Logs

C# log

Failed to find dotnet info from path, falling back to acquire runtime via ms-dotnettools.vscode-dotnet-runtime A valid dotnet installation could not be found Dotnet path: /home/fuszenecker/.config/Code/User/globalStorage/ms-dotnettools.vscode-dotnet-runtime/.dotnet/7.0.10/dotnet Activating C# standalone... The .NET Core SDK cannot be located: A valid dotnet installation could not be found. .NET Core debugging will not be enabled. Make sure the .NET Core SDK is installed and is on the path. [Info - 11:19:31 AM] [Program]Language server initialized No .NET SDKs were found.

Download a .NET SDK:
https://aka.ms/dotnet/download

Learn about SDK resolution:
https://aka.ms/dotnet/sdk-not-found
[Error - 11:19:33 AM] [LanguageServerHost]System.InvalidOperationException: Failed to find an appropriate version of .NET Core MSBuild. Call to hostfxr_resolve_sdk2 failed. There may be more details in stderr.
at Microsoft.Build.Locator.DotNetSdkLocationHelper.GetDotNetBasePaths(String workingDirectory)+MoveNext()
at Microsoft.Build.Locator.DotNetSdkLocationHelper.GetInstances(String workingDirectory)+MoveNext()
at Microsoft.Build.Locator.MSBuildLocator.GetInstances(VisualStudioInstanceQueryOptions options)+MoveNext()
at System.Linq.Enumerable.WhereEnumerableIterator1.MoveNext() at System.Linq.Enumerable.TryGetFirst[TSource](IEnumerable1 source, Boolean& found)
at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable1 source) at Microsoft.CodeAnalysis.LanguageServer.HostWorkspace.LanguageServerProjectSystem.TryEnsureMSBuildLoadedAsync(String workingDirectory) in /_/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/HostWorkspace/LanguageServerProjectSystem.cs:line 140 at Microsoft.CodeAnalysis.LanguageServer.HostWorkspace.LanguageServerProjectSystem.OpenSolutionAsync(String solutionFilePath) in /_/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/HostWorkspace/LanguageServerProjectSystem.cs:line 78 at Microsoft.CommonLanguageServerProtocol.Framework.QueueItem3.StartRequestAsync(TRequestContext context, CancellationToken cancellationToken) in /_/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/QueueItem.cs:line 136
Failed to find dotnet info from path, falling back to acquire runtime via ms-dotnettools.vscode-dotnet-runtime
A valid dotnet installation could not be found

C# LSP Trace Logs

Extension vscode.bat does not contribute csharpExtensionLoadPaths Extension vscode.clojure does not contribute csharpExtensionLoadPaths Extension vscode.coffeescript does not contribute csharpExtensionLoadPaths Extension vscode.configuration-editing does not contribute csharpExtensionLoadPaths Extension vscode.cpp does not contribute csharpExtensionLoadPaths Extension vscode.csharp does not contribute csharpExtensionLoadPaths Extension vscode.css does not contribute csharpExtensionLoadPaths Extension vscode.css-language-features does not contribute csharpExtensionLoadPaths Extension vscode.dart does not contribute csharpExtensionLoadPaths Extension vscode.debug-auto-launch does not contribute csharpExtensionLoadPaths Extension vscode.debug-server-ready does not contribute csharpExtensionLoadPaths Extension vscode.diff does not contribute csharpExtensionLoadPaths Extension vscode.docker does not contribute csharpExtensionLoadPaths Extension vscode.emmet does not contribute csharpExtensionLoadPaths Extension vscode.extension-editing does not contribute csharpExtensionLoadPaths Extension vscode.fsharp does not contribute csharpExtensionLoadPaths Extension vscode.git does not contribute csharpExtensionLoadPaths Extension vscode.git-base does not contribute csharpExtensionLoadPaths Extension vscode.github does not contribute csharpExtensionLoadPaths Extension vscode.github-authentication does not contribute csharpExtensionLoadPaths Extension vscode.go does not contribute csharpExtensionLoadPaths Extension vscode.groovy does not contribute csharpExtensionLoadPaths Extension vscode.grunt does not contribute csharpExtensionLoadPaths Extension vscode.gulp does not contribute csharpExtensionLoadPaths Extension vscode.handlebars does not contribute csharpExtensionLoadPaths Extension vscode.hlsl does not contribute csharpExtensionLoadPaths Extension vscode.html does not contribute csharpExtensionLoadPaths Extension vscode.html-language-features does not contribute csharpExtensionLoadPaths Extension vscode.ini does not contribute csharpExtensionLoadPaths Extension vscode.ipynb does not contribute csharpExtensionLoadPaths Extension vscode.jake does not contribute csharpExtensionLoadPaths Extension vscode.java does not contribute csharpExtensionLoadPaths Extension vscode.javascript does not contribute csharpExtensionLoadPaths Extension vscode.json does not contribute csharpExtensionLoadPaths Extension vscode.json-language-features does not contribute csharpExtensionLoadPaths Extension vscode.julia does not contribute csharpExtensionLoadPaths Extension vscode.latex does not contribute csharpExtensionLoadPaths Extension vscode.less does not contribute csharpExtensionLoadPaths Extension vscode.log does not contribute csharpExtensionLoadPaths Extension vscode.lua does not contribute csharpExtensionLoadPaths Extension vscode.make does not contribute csharpExtensionLoadPaths Extension vscode.markdown does not contribute csharpExtensionLoadPaths Extension vscode.markdown-language-features does not contribute csharpExtensionLoadPaths Extension vscode.markdown-math does not contribute csharpExtensionLoadPaths Extension vscode.media-preview does not contribute csharpExtensionLoadPaths Extension vscode.merge-conflict does not contribute csharpExtensionLoadPaths Extension vscode.microsoft-authentication does not contribute csharpExtensionLoadPaths Extension ms-vscode.js-debug does not contribute csharpExtensionLoadPaths Extension ms-vscode.js-debug-companion does not contribute csharpExtensionLoadPaths Extension ms-vscode.vscode-js-profile-table does not contribute csharpExtensionLoadPaths Extension vscode.builtin-notebook-renderers does not contribute csharpExtensionLoadPaths Extension vscode.npm does not contribute csharpExtensionLoadPaths Extension vscode.objective-c does not contribute csharpExtensionLoadPaths Extension vscode.perl does not contribute csharpExtensionLoadPaths Extension vscode.php does not contribute csharpExtensionLoadPaths Extension vscode.php-language-features does not contribute csharpExtensionLoadPaths Extension vscode.powershell does not contribute csharpExtensionLoadPaths Extension vscode.pug does not contribute csharpExtensionLoadPaths Extension vscode.python does not contribute csharpExtensionLoadPaths Extension vscode.r does not contribute csharpExtensionLoadPaths Extension vscode.razor does not contribute csharpExtensionLoadPaths Extension vscode.references-view does not contribute csharpExtensionLoadPaths Extension vscode.restructuredtext does not contribute csharpExtensionLoadPaths Extension vscode.ruby does not contribute csharpExtensionLoadPaths Extension vscode.rust does not contribute csharpExtensionLoadPaths Extension vscode.scss does not contribute csharpExtensionLoadPaths Extension vscode.search-result does not contribute csharpExtensionLoadPaths Extension vscode.shaderlab does not contribute csharpExtensionLoadPaths Extension vscode.shellscript does not contribute csharpExtensionLoadPaths Extension vscode.simple-browser does not contribute csharpExtensionLoadPaths Extension vscode.sql does not contribute csharpExtensionLoadPaths Extension vscode.swift does not contribute csharpExtensionLoadPaths Extension vscode.theme-abyss does not contribute csharpExtensionLoadPaths Extension vscode.theme-defaults does not contribute csharpExtensionLoadPaths Extension vscode.theme-kimbie-dark does not contribute csharpExtensionLoadPaths Extension vscode.theme-monokai does not contribute csharpExtensionLoadPaths Extension vscode.theme-monokai-dimmed does not contribute csharpExtensionLoadPaths Extension vscode.theme-quietlight does not contribute csharpExtensionLoadPaths Extension vscode.theme-red does not contribute csharpExtensionLoadPaths Extension vscode.vscode-theme-seti does not contribute csharpExtensionLoadPaths Extension vscode.theme-solarized-dark does not contribute csharpExtensionLoadPaths Extension vscode.theme-solarized-light does not contribute csharpExtensionLoadPaths Extension vscode.theme-tomorrow-night-blue does not contribute csharpExtensionLoadPaths Extension vscode.typescript does not contribute csharpExtensionLoadPaths Extension vscode.typescript-language-features does not contribute csharpExtensionLoadPaths Extension vscode.vb does not contribute csharpExtensionLoadPaths Extension vscode.xml does not contribute csharpExtensionLoadPaths Extension vscode.yaml does not contribute csharpExtensionLoadPaths Extension alexcvzz.vscode-sqlite does not contribute csharpExtensionLoadPaths Extension aliasadidev.nugetpackagemanagergui does not contribute csharpExtensionLoadPaths Extension christian-kohler.path-intellisense does not contribute csharpExtensionLoadPaths Extension ckolkman.vscode-postgres does not contribute csharpExtensionLoadPaths Extension DavidAnson.vscode-markdownlint does not contribute csharpExtensionLoadPaths Extension eamodio.gitlens does not contribute csharpExtensionLoadPaths Extension GitHub.copilot does not contribute csharpExtensionLoadPaths Extension humao.rest-client does not contribute csharpExtensionLoadPaths Extension icsharpcode.ilspy-vscode does not contribute csharpExtensionLoadPaths Extension josefpihrt-vscode.roslynator does not contribute csharpExtensionLoadPaths Extension ms-azuretools.vscode-docker does not contribute csharpExtensionLoadPaths Extension ms-dotnettools.blazorwasm-companion does not contribute csharpExtensionLoadPaths Extension ms-dotnettools.csharp does not contribute csharpExtensionLoadPaths Extension ms-dotnettools.dotnet-interactive-vscode does not contribute csharpExtensionLoadPaths Extension ms-dotnettools.vscode-dotnet-pack does not contribute csharpExtensionLoadPaths Extension ms-dotnettools.vscode-dotnet-runtime does not contribute csharpExtensionLoadPaths Extension ms-kubernetes-tools.vscode-kubernetes-tools does not contribute csharpExtensionLoadPaths Extension ms-python.python does not contribute csharpExtensionLoadPaths Extension ms-toolsai.jupyter does not contribute csharpExtensionLoadPaths Extension ms-toolsai.jupyter-keymap does not contribute csharpExtensionLoadPaths Extension ms-toolsai.jupyter-renderers does not contribute csharpExtensionLoadPaths Extension ms-toolsai.vscode-jupyter-cell-tags does not contribute csharpExtensionLoadPaths Extension ms-toolsai.vscode-jupyter-slideshow does not contribute csharpExtensionLoadPaths Extension ms-vscode-remote.remote-containers does not contribute csharpExtensionLoadPaths Extension ms-vscode-remote.remote-ssh does not contribute csharpExtensionLoadPaths Extension ms-vscode-remote.remote-ssh-edit does not contribute csharpExtensionLoadPaths Extension ms-vscode-remote.vscode-remote-extensionpack does not contribute csharpExtensionLoadPaths Extension ms-vscode.makefile-tools does not contribute csharpExtensionLoadPaths Extension ms-vscode.powershell does not contribute csharpExtensionLoadPaths Extension ms-vscode.remote-explorer does not contribute csharpExtensionLoadPaths Extension ms-vscode.remote-server does not contribute csharpExtensionLoadPaths Extension Okteto.remote-kubernetes does not contribute csharpExtensionLoadPaths Extension quicktype.quicktype does not contribute csharpExtensionLoadPaths Extension redhat.vscode-yaml does not contribute csharpExtensionLoadPaths Extension rogalmic.vscode-xml-complete does not contribute csharpExtensionLoadPaths Extension vscode-icons-team.vscode-icons does not contribute csharpExtensionLoadPaths Extension yzane.markdown-pdf does not contribute csharpExtensionLoadPaths Extension yzhang.markdown-all-in-one does not contribute csharpExtensionLoadPaths Extension zxh404.vscode-proto3 does not contribute csharpExtensionLoadPaths

Environment information

VSCode version: 1.81.1
C# Extension: 2.0.376
Using OmniSharp: false

Dotnet Information

Host:
Version: 7.0.10
Architecture: x64
Commit: a6dbb800a4

.NET SDKs installed:
No SDKs were found.

.NET runtimes installed:
Microsoft.NETCore.App 7.0.10 [/home/fuszenecker/.config/Code/User/globalStorage/ms-dotnettools.vscode-dotnet-runtime/.dotnet/7.0.10/shared/Microsoft.NETCore.App]

Other architectures found:
None

Environment variables:
Not set

global.json file:
Not found

Learn more:
https://aka.ms/dotnet/info

Download .NET:
https://aka.ms/dotnet/download

Visual Studio Code Extensions
Extension Author Version Folder Name
blazorwasm-companion ms-dotnettools 1.1.4 ms-dotnettools.blazorwasm-companion-1.1.4
copilot GitHub 1.104.341 github.copilot-1.104.341
csharp ms-dotnettools 2.0.376 ms-dotnettools.csharp-2.0.376-linux-x64
dotnet-interactive-vscode ms-dotnettools 1.0.4403010 ms-dotnettools.dotnet-interactive-vscode-1.0.4403010
gitlens eamodio 14.2.1 eamodio.gitlens-14.2.1
ilspy-vscode icsharpcode 0.16.1 icsharpcode.ilspy-vscode-0.16.1
jupyter ms-toolsai 2023.7.1002162226 ms-toolsai.jupyter-2023.7.1002162226-linux-x64
jupyter-keymap ms-toolsai 1.1.2 ms-toolsai.jupyter-keymap-1.1.2
jupyter-renderers ms-toolsai 1.0.17 ms-toolsai.jupyter-renderers-1.0.17
makefile-tools ms-vscode 0.7.0 ms-vscode.makefile-tools-0.7.0
markdown-all-in-one yzhang 3.5.1 yzhang.markdown-all-in-one-3.5.1
markdown-pdf yzane 1.4.4 yzane.markdown-pdf-1.4.4
nugetpackagemanagergui aliasadidev 2.0.6 aliasadidev.nugetpackagemanagergui-2.0.6
path-intellisense christian-kohler 2.8.4 christian-kohler.path-intellisense-2.8.4
powershell ms-vscode 2023.6.0 ms-vscode.powershell-2023.6.0
python ms-python 2023.14.0 ms-python.python-2023.14.0
quicktype quicktype 12.0.46 quicktype.quicktype-12.0.46
remote-containers ms-vscode-remote 0.304.0 ms-vscode-remote.remote-containers-0.304.0
remote-explorer ms-vscode 0.4.1 ms-vscode.remote-explorer-0.4.1
remote-kubernetes Okteto 0.4.10 okteto.remote-kubernetes-0.4.10
remote-server ms-vscode 1.4.0 ms-vscode.remote-server-1.4.0
remote-ssh ms-vscode-remote 0.102.0 ms-vscode-remote.remote-ssh-0.102.0
remote-ssh-edit ms-vscode-remote 0.86.0 ms-vscode-remote.remote-ssh-edit-0.86.0
rest-client humao 0.25.1 humao.rest-client-0.25.1
roslynator josefpihrt-vscode 4.4.0 josefpihrt-vscode.roslynator-4.4.0
vscode-docker ms-azuretools 1.26.0 ms-azuretools.vscode-docker-1.26.0
vscode-dotnet-pack ms-dotnettools 1.0.12 ms-dotnettools.vscode-dotnet-pack-1.0.12
vscode-dotnet-runtime ms-dotnettools 1.7.0 ms-dotnettools.vscode-dotnet-runtime-1.7.0
vscode-icons vscode-icons-team 12.5.0 vscode-icons-team.vscode-icons-12.5.0
vscode-jupyter-cell-tags ms-toolsai 0.1.8 ms-toolsai.vscode-jupyter-cell-tags-0.1.8
vscode-jupyter-slideshow ms-toolsai 0.1.5 ms-toolsai.vscode-jupyter-slideshow-0.1.5
vscode-kubernetes-tools ms-kubernetes-tools 1.3.13 ms-kubernetes-tools.vscode-kubernetes-tools-1.3.13
vscode-markdownlint DavidAnson 0.51.0 davidanson.vscode-markdownlint-0.51.0
vscode-postgres ckolkman 1.4.3 ckolkman.vscode-postgres-1.4.3
vscode-proto3 zxh404 0.5.5 zxh404.vscode-proto3-0.5.5
vscode-remote-extensionpack ms-vscode-remote 0.24.0 ms-vscode-remote.vscode-remote-extensionpack-0.24.0
vscode-sqlite alexcvzz 0.14.1 alexcvzz.vscode-sqlite-0.14.1
vscode-xml-complete rogalmic 0.3.0 rogalmic.vscode-xml-complete-0.3.0
vscode-yaml redhat 1.14.0 redhat.vscode-yaml-1.14.0

Extension version: 2.0.376
VS Code version: Code 1.81.1 (6c3e3dba23e8fadc360aed75ce363ba185c49794, 2023-08-09T22:18:39.991Z)
OS version: Linux x64 6.4.10-arch1-1
Modes:

System Info
Item Value
CPUs Intel(R) Core(TM) i3-5005U CPU @ 2.00GHz (4 x 1895)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
video_decode: enabled
video_encode: disabled_software
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: disabled_off
Load (avg) 3, 3, 2
Memory (System) 3.74GB (0.92GB free)
Process Argv --unity-launch --crash-reporter-id 29d118ce-ff35-495d-949f-64a4eccdfcf9
Screen Reader no
VM 0%
DESKTOP_SESSION plasmawayland
XDG_CURRENT_DESKTOP KDE
XDG_SESSION_DESKTOP KDE
XDG_SESSION_TYPE wayland
A/B Experiments
vsliv368:30146709
vsreu685:30147344
python383:30185418
vspor879:30202332
vspor708:30202333
vspor363:30204092
vslsvsres303:30308271
vserr242:30382549
pythontb:30283811
vsjup518:30340749
pythonptprofiler:30281270
vshan820:30294714
vstes263:30335439
vscoreces:30445986
vscod805cf:30301675
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
vsaa593:30376534
pythonvs932:30410667
vsclangdc:30486549
c4g48928:30535728
dsvsc012:30540252
pynewext54:30695312
azure-dev_surveyone:30548225
vscccc:30803845
3biah626:30602489
89544117:30613380
showlangstatbar:30737416
03d35959:30757346
pythonfmttext:30731395
pythoncmvfstrcf:30756944
fixshowwlkth:30771522
showindicator:30805244
pythongtdpath:30769146
i26e3531:30792625
gsofa:30804715
pythonnosmt12:30797651
pythonidxpt:30805730
pythonnoceb:30805159
dsvsc013:30795093
dsvsc014:30804076
diffeditorv1:30812748

@dibarbet
Copy link
Member

dibarbet commented Aug 20, 2023

@fuszenecker

Thanks for the report. I'm having trouble reproing this on my linux machine, so I could use some additional info. I have a couple guesses, but not 100% sure.

  1. Do you have the omnisharp.dotNetCliPaths option set?
  2. Would you also be able to run dotnet --info and paste the output?
  3. I have a potential related fix in Do not cache calls to dotnet info #6180 . Would you be able to try it out and let me know? You can find the linux x64 vsix here https://artprodcus3.artifacts.visualstudio.com/A6fcc92e5-73a7-4f88-8d13-d9045b45fb27/cbb18261-c48f-4abb-8651-8cdcb5474649/_apis/artifact/cGlwZWxpbmVhcnRpZmFjdDovL2RuY2VuZy1wdWJsaWMvcHJvamVjdElkL2NiYjE4MjYxLWM0OGYtNGFiYi04NjUxLThjZGNiNTQ3NDY0OS9idWlsZElkLzM3OTk3Ny9hcnRpZmFjdE5hbWUvVlNJWHMrLStBdHRlbXB0KzE1/content?format=file&subPath=%2Fcsharp-linux-x64-2.0.401-g768b7c92dc.vsix

@arunchndr arunchndr added the .Net sdk not found These are a group of issues when the dotnet sdk could not be found label Aug 21, 2023
@arunchndr arunchndr added this to the September milestone Aug 21, 2023
@arunchndr arunchndr modified the milestones: September, October Oct 2, 2023
@dibarbet dibarbet modified the milestones: October2023, November2023 Nov 9, 2023
@dibarbet
Copy link
Member

dibarbet commented Nov 9, 2023

Going to close this issue. We've made a number of changes around dotnet resolution that may have helped with this problem. If you're still encountering issues with find the SDK, please file a new issue with C# output window logs from the latest extension version.

@dibarbet dibarbet closed this as not planned Won't fix, can't repro, duplicate, stale Nov 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
.Net sdk not found These are a group of issues when the dotnet sdk could not be found Resolved-Not Reproducible
Projects
None yet
Development

No branches or pull requests

3 participants