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 - Linux (Debian) #6179

Closed
landonwilkins opened this issue Aug 19, 2023 · 24 comments
Closed

The .NET Core SDK cannot be located - Linux (Debian) #6179

landonwilkins opened this issue Aug 19, 2023 · 24 comments
Assignees
Labels
.Net sdk not found These are a group of issues when the dotnet sdk could not be found Resolved-Configuration Issue
Milestone

Comments

@landonwilkins
Copy link

landonwilkins commented Aug 19, 2023

Type: Bug

Issue Description

I've installed dotnet using the dotnet installer script: https://learn.microsoft.com/en-us/dotnet/core/install/linux-scripted-manual#scripted-install

I've verified dotnet is installed

which dotnet: /usr/local/google/home/landonwilkins/.dotnet/dotnet

dotnet --info
.NET SDK:
 Version:   7.0.400
 Commit:    73bf45718d

Runtime Environment:
 OS Name:     debian
 OS Version:
 OS Platform: Linux
 RID:         debian-x64
 Base Path:   /usr/local/google/home/landonwilkins/.dotnet/sdk/7.0.400/

Host:
  Version:      7.0.10
  Architecture: x64
  Commit:       a6dbb800a4

.NET SDKs installed:
  6.0.413 [/usr/local/google/home/landonwilkins/.dotnet/sdk]
  7.0.400 [/usr/local/google/home/landonwilkins/.dotnet/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 6.0.21 [/usr/local/google/home/landonwilkins/.dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 7.0.10 [/usr/local/google/home/landonwilkins/.dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 6.0.21 [/usr/local/google/home/landonwilkins/.dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 7.0.10 [/usr/local/google/home/landonwilkins/.dotnet/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

Steps to Reproduce

  • Install` the C# vscode extension
  • See the error saying "The .Net Core SDK cannot be located"

Expected Behavior

  • The .Net Core SDK is located

Actual Behavior

  • See the error saying "The .Net Core SDK cannot be located"

Logs

C# log

Post the output from Output-->C# here

C# LSP Trace Logs

Post the output from Output-->C# LSP Trace Logs here. Requires `dotnet.server.trace` to be set to `Trace`

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 [/usr/local/google/home/landonwilkins/.vscode-server/data/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
csdevkit ms-dotnettools 0.4.5 ms-dotnettools.csdevkit-0.4.5-linux-x64
csharp ms-dotnettools 2.0.376 ms-dotnettools.csharp-2.0.376-linux-x64
jupyter ms-toolsai 2023.7.1002162226 ms-toolsai.jupyter-2023.7.1002162226-linux-x64
jupyter-renderers ms-toolsai 1.0.17 ms-toolsai.jupyter-renderers-1.0.17
python ms-python 2023.14.0 ms-python.python-2023.14.0
vscode-dotnet-runtime ms-dotnettools 1.7.0 ms-dotnettools.vscode-dotnet-runtime-1.7.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-pylance ms-python 2023.8.30 ms-python.vscode-pylance-2023.8.30
vscodeintellicode-csharp ms-dotnettools 0.1.26 ms-dotnettools.vscodeintellicode-csharp-0.1.26-linux-x64

Extension version: 2.0.376
VS Code version: Code 1.81.1 (Universal) (6c3e3dba23e8fadc360aed75ce363ba185c49794, 2023-08-09T22:20:33.924Z)
OS version: Darwin arm64 22.6.0
Modes:
Remote OS version: Linux x64 6.3.11-1rodete1-amd64

System Info
Item Value
CPUs Apple M1 Pro (10 x 24)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
metal: disabled_off
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled
Load (avg) 5, 6, 7
Memory (System) 32.00GB (2.09GB free)
Process Argv --crash-reporter-id c60714fa-1199-466f-a4fd-c3744b0034c9
Screen Reader no
VM 0%
Item Value
Remote SSH: ldw.c.googlers.com
OS Linux x64 6.3.11-1rodete1-amd64
CPUs Intel(R) Xeon(R) CPU @ 2.20GHz (24 x 2199)
Memory (System) 94.29GB (88.79GB free)
VM 0%
A/B Experiments
vsliv368cf:30146710
vsreu685:30147344
python383:30185418
vspor879:30202332
vspor708:30202333
vspor363:30204092
vslsvsres303:30308271
vserr242cf:30382550
pythontb:30283811
vsjup518:30340749
pythonptprofiler:30281270
vshan820:30294714
vstes263:30335439
vscod805cf:30301675
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
vsaa593:30376534
pythonvs932:30410667
py29gd2263cf:30792227
vsclangdf:30486550
c4g48928:30535728
dsvsc012cf:30540253
pynewext54:30695312
azure-dev_surveyone:30548225
vscccc:30803845
2e4cg342:30602488
f6dab269:30613381
showlangstatbar:30737416
03d35959:30757346
ecj1e332:30736112
pythonfmttext:30731395
pythoncmvfstrcf:30756944
fixshowwlkth:30771522
showindicator:30805244
pythongtdpath:30769146
i26e3531:30792625
gsofb:30804716
pythonnosmt12:30797651
pythonidxptcf:30805731
pythonnoceb:30805159
dsvsc013:30795093
dsvsc014:30804076
diffeditorv1:30812748

@landonwilkins
Copy link
Author

Extra context:

I'm running vscode on my macbook, but using vscode's Remote Explore to ssh into my linux machine.

I have dotnet installed in both macbook and linux.

@dibarbet
Copy link
Member

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. Can you post the contents of the C# output window here?
  2. Do you have the omnisharp.dotNetCliPaths option set?
  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? It would need to be installed on the remote linux machine. 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

@landonwilkins
Copy link
Author

Do you have the omnisharp.dotNetCliPaths option set?

Yes, I tried this after it didn't work. I added... oh!

I added the Mac path, not the Linux path, let me change that to the Linux path:
/usr/local/google/home/landonwilkins/.dotnet/dotnet

Nope, still doesn't work after restarting vscode

I have a potential related fix

I'm happy to try it out! One sec, let me uninstall the other one...

Can you post the contents of the C# output window here?

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.
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: /usr/local/google/home/landonwilkins/.vscode-server/data/User/globalStorage/ms-dotnettools.vscode-dotnet-runtime/.dotnet/7.0.10/dotnet
Activating C# + C# Dev Kit + C# IntelliCode...
[Info  - 11:18:59 AM] [Program]Language server initialized
[Error - 11:20:29 AM] Request textDocument/inlayHint failed.
  Message: Invalid URI: The hostname could not be parsed.
  Code: -32000 
[object Object]
[Error - 11:20:29 AM] Request textDocument/codeAction failed.
  Message: Invalid URI: The hostname could not be parsed.
  Code: -32000 
[object Object]
[Error - 11:20:29 AM] Request textDocument/semanticTokens/range failed.
  Message: Invalid URI: The hostname could not be parsed.
  Code: -32000 
[object Object]
[Error - 11:20:29 AM] Request textDocument/codeAction failed.
  Message: Invalid URI: The hostname could not be parsed.
  Code: -32000 
[object Object]
[Error - 11:20:30 AM] Request textDocument/foldingRange failed.
  Message: Invalid URI: The hostname could not be parsed.
  Code: -32000 
[object Object]
[Error - 11:20:30 AM] Request textDocument/codeLens failed.
  Message: Invalid URI: The hostname could not be parsed.
  Code: -32000 
[object Object]
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

@landonwilkins
Copy link
Author

Aside, good to know about the C# output! If nothing else works, I bet I can symlink the path below to /usr/local/google/home/landonwilkins/.dotnet/dotnet

/usr/local/google/home/landonwilkins/.vscode-server/data/User/globalStorage/ms-dotnettools.vscode-dotnet-runtime/.dotnet/7.0.10/dotnet

Usage: dotnet [options]
Usage: dotnet [path-to-application]

Options:
  -h|--help         Display help.
  --info            Display .NET information.
  --list-sdks       Display the installed SDKs.
  --list-runtimes   Display the installed runtimes.

path-to-application:
  The path to an application .dll file to execute.


/usr/local/google/home/landonwilkins/.vscode-server/data/User/globalStorage/ms-dotnettools.vscode-dotnet-runtime/.dotnet/7.0.10/dotnet --version
The command could not be loaded, possibly because:
  * You intended to execute a .NET application:
      The application '--version' does not exist.
  * You intended to execute a .NET SDK command:
      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

@landonwilkins
Copy link
Author

Ok, I tried your fix! Here is what happened in the C# output:

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.
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: /usr/local/google/home/landonwilkins/.vscode-server/data/User/globalStorage/ms-dotnettools.vscode-dotnet-runtime/.dotnet/7.0.10/dotnet
Activating C# standalone...
[Info  - 11:35:39 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:35:39 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.WhereEnumerableIterator`1.MoveNext()
   at System.Linq.Enumerable.TryGetFirst[TSource](IEnumerable`1 source, Boolean& found)
   at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 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.QueueItem`3.StartRequestAsync(TRequestContext context, CancellationToken cancellationToken) in /_/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/QueueItem.cs:line 136

@landonwilkins
Copy link
Author

Ok, I don't think your fix is the problem with the above. I uninstalled the C# extension and symlinked:

ln -s /usr/local/google/home/landonwilkins/.dotnet/dotnet /usr/local/google/home/landonwilkins/.vscode-server/data/User/globalStorage/ms-dotnettools.vscode-dotnet-runtime/.dotnet/7.0.10/dotnet

But I see that same issue after installing the C# extension from the store

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.
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: /usr/local/google/home/landonwilkins/.vscode-server/data/User/globalStorage/ms-dotnettools.vscode-dotnet-runtime/.dotnet/7.0.10/dotnet
Activating C# standalone...
[Info  - 11:55:43 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:55:44 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.WhereEnumerableIterator`1.MoveNext()
   at System.Linq.Enumerable.TryGetFirst[TSource](IEnumerable`1 source, Boolean& found)
   at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 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.QueueItem`3.StartRequestAsync(TRequestContext context, CancellationToken cancellationToken) in /_/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/QueueItem.cs:line 136
dotnet --version
7.0.400

dotnet --list-runtimes
Microsoft.AspNetCore.App 6.0.21 [/usr/local/google/home/landonwilkins/.dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 7.0.10 [/usr/local/google/home/landonwilkins/.dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 6.0.21 [/usr/local/google/home/landonwilkins/.dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 7.0.10 [/usr/local/google/home/landonwilkins/.dotnet/shared/Microsoft.NETCore.App]

dotnet --list-sdks
6.0.413 [/usr/local/google/home/landonwilkins/.dotnet/sdk]
7.0.400 [/usr/local/google/home/landonwilkins/.dotnet/sdk]

@dibarbet
Copy link
Member

Thanks, that at least rules out a couple issues. I wouldn't recommend symlinking to runtime downloaded in the vscode global storage, that's likely not going to help - it shouldn't be using that copy to begin with.

The interesting thing here is that your manual 'dotnet --info' output looks correct - but the when the extension runs 'dotnet --info' it appears to be only running against the downloaded runtime version. This can happen for example if DOTNET_ROOT is pointing to the wrong location.

Three things to try until I can look more on Monday

  1. Can you confirm the dotnet root env var isn't set? I don't see it in your info, but just to confirm.
  2. You could try setting the 'dotnet.dotnetPath' option to the folder contains the dotnet executable.
  3. With my fix, the cli paths option might work as well

@landonwilkins
Copy link
Author

You could try setting the 'dotnet.dotnetPath' option to the folder contains the dotnet executable.

This worked! That error is gone! I've verified this only works if I use your fix.

image

which dotnet
/usr/local/google/home/landonwilkins/.dotnet/dotnet

Feel free to ignore the rest of this message

Can you confirm the dotnet root env var isn't set? I don't see it in your info, but just to confirm.

echo $DOTNET_ROOT returns nothing

With my fix, the cli paths option might work as well

Ok, I installed your fix and I still have that cli paths option as the CLI: /usr/local/google/home/landonwilkins/.dotnet/dotnet

image

Still seeing the error

@landonwilkins
Copy link
Author

landonwilkins commented Aug 20, 2023

I still see these kinds of errors, but maybe they're not as important?

[Error - 11:20:29 AM] Request textDocument/inlayHint failed.
  Message: Invalid URI: The hostname could not be parsed.
  Code: -32000 
[object Object]
[Error - 11:20:29 AM] Request textDocument/codeAction failed.
  Message: Invalid URI: The hostname could not be parsed.
  Code: -32000 
[object Object]
[Error - 11:20:29 AM] Request textDocument/semanticTokens/range failed.
  Message: Invalid URI: The hostname could not be parsed.
  Code: -32000 
[object Object]
[Error - 11:20:29 AM] Request textDocument/codeAction failed.
  Message: Invalid URI: The hostname could not be parsed.
  Code: -32000 
[object Object]
[Error - 11:20:30 AM] Request textDocument/foldingRange failed.
  Message: Invalid URI: The hostname could not be parsed.
  Code: -32000 
[object Object]
[Error - 11:20:30 AM] Request textDocument/codeLens failed.
  Message: Invalid URI: The hostname could not be parsed.
  Code: -32000 
[object Object]

one sec, taking a while to reinstall your fix...

@landonwilkins
Copy link
Author

landonwilkins commented Aug 20, 2023

Wait, I'm getting the same errors again (on your fix), let me try to reset all the settings

I shouldn't have uninstalled your fix and tried the current version on the extension store

Actually, I'm not sure it was ever fixed

(This can definitely wait til Monday, thanks!!!)

image

Dotnet path: /usr/local/google/home/landonwilkins/.dotnet/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  - 3:59:59 PM] [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 - 3:59:59 PM] [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.WhereEnumerableIterator`1.MoveNext()
   at System.Linq.Enumerable.TryGetFirst[TSource](IEnumerable`1 source, Boolean& found)
   at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 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.QueueItem`3.StartRequestAsync(TRequestContext context, CancellationToken cancellationToken) in /_/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/QueueItem.cs:line 136

Oh, and I currently have omnisharp.json set on my remote linux machine, even tho I didn't install using snap:

cat ~/.omnisharp/omnisharp.json
{
 "MSBuild": {
     "UseLegacySdkResolver": true
 }
}

I found this in help page https://github.com/dotnet/vscode-csharp/wiki/Troubleshooting:-'The-.NET-Core-SDK-cannot-be-located.'-errors

@dibarbet
Copy link
Member

I still see these kinds of errors, but maybe they're not as important?

They're unexpected, but almost certainly unrelated to the dotnet issue here. If you could set the dotnet.server.trace setting to Trace and attach the C# LSP trace logs output window contents to this issue that I filed to track it - #6181

Actually, I'm not sure it was ever fixed

So I've just updated my PR to adjust the logging to see if I can get more details on what exactly is going wrong. The new extension version is here if you wouldn't mind trying it: https://artprodcus3.artifacts.visualstudio.com/A6fcc92e5-73a7-4f88-8d13-d9045b45fb27/cbb18261-c48f-4abb-8651-8cdcb5474649/_apis/artifact/cGlwZWxpbmVhcnRpZmFjdDovL2RuY2VuZy1wdWJsaWMvcHJvamVjdElkL2NiYjE4MjYxLWM0OGYtNGFiYi04NjUxLThjZGNiNTQ3NDY0OS9idWlsZElkLzM4MDM3Mi9hcnRpZmFjdE5hbWUvVlNJWHMrLStBdHRlbXB0KzE1/content?format=file&subPath=%2Fcsharp-linux-x64-2.0.402-gc1f776a5b2.vsix

And, if you could run /usr/local/google/home/landonwilkins/.dotnet/dotnet --info and paste the output of that here as well.

Btw, I definitely appreciate you trying everything out here, it's extremely useful.

@landonwilkins
Copy link
Author

Btw, I definitely appreciate you trying everything out here, it's extremely useful.

You are helping me! Thanks!

image

And, if you could run /usr/local/google/home/landonwilkins/.dotnet/dotnet --info and paste the output of that here as well.

/usr/local/google/home/landonwilkins/.dotnet/dotnet --info
.NET SDK:
 Version:   7.0.400
 Commit:    73bf45718d

Runtime Environment:
 OS Name:     debian
 OS Version:
 OS Platform: Linux
 RID:         debian-x64
 Base Path:   /usr/local/google/home/landonwilkins/.dotnet/sdk/7.0.400/

Host:
  Version:      7.0.10
  Architecture: x64
  Commit:       a6dbb800a4

.NET SDKs installed:
  6.0.413 [/usr/local/google/home/landonwilkins/.dotnet/sdk]
  7.0.400 [/usr/local/google/home/landonwilkins/.dotnet/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 6.0.21 [/usr/local/google/home/landonwilkins/.dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 7.0.10 [/usr/local/google/home/landonwilkins/.dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 6.0.21 [/usr/local/google/home/landonwilkins/.dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 7.0.10 [/usr/local/google/home/landonwilkins/.dotnet/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

C# logs

Dotnet path: /usr/local/google/home/landonwilkins/.dotnet/dotnet
Activating C# standalone...
Starting server at /usr/local/google/home/landonwilkins/.vscode-server/extensions/ms-dotnettools.csharp-2.0.402-gc1f776a5b2/.roslyn/Microsoft.CodeAnalysis.LanguageServer
The .NET Core SDK cannot be located: Error running dotnet --info: Error: Command failed: dotnet --info
/bin/sh: line 1: dotnet: command not found


/bin/sh: line 1: dotnet: command not found
. .NET Core debugging will not be enabled. Make sure the .NET Core SDK is installed and is on the path.
dbug: LanguageServerWorkspaceFactory[0]
      Solution-level analyzer at /usr/local/google/home/landonwilkins/.vscode-server/extensions/ms-dotnettools.csharp-2.0.402-gc1f776a5b2/.roslyn/Microsoft.CodeAnalysis.Remote.Workspaces.dll added to workspace.
dbug: LanguageServerWorkspaceFactory[0]
      Solution-level analyzer at /usr/local/google/home/landonwilkins/.vscode-server/extensions/ms-dotnettools.csharp-2.0.402-gc1f776a5b2/.roslyn/Microsoft.CodeAnalysis.dll added to workspace.
dbug: LanguageServerWorkspaceFactory[0]
      Solution-level analyzer at /usr/local/google/home/landonwilkins/.vscode-server/extensions/ms-dotnettools.csharp-2.0.402-gc1f776a5b2/.roslyn/Microsoft.CodeAnalysis.Scripting.dll added to workspace.
dbug: LanguageServerWorkspaceFactory[0]
      Solution-level analyzer at /usr/local/google/home/landonwilkins/.vscode-server/extensions/ms-dotnettools.csharp-2.0.402-gc1f776a5b2/.roslyn/Microsoft.CodeAnalysis.Workspaces.dll added to workspace.
dbug: LanguageServerWorkspaceFactory[0]
      Solution-level analyzer at /usr/local/google/home/landonwilkins/.vscode-server/extensions/ms-dotnettools.csharp-2.0.402-gc1f776a5b2/.roslyn/Microsoft.CodeAnalysis.Features.dll added to workspace.
dbug: LanguageServerWorkspaceFactory[0]
      Solution-level analyzer at /usr/local/google/home/landonwilkins/.vscode-server/extensions/ms-dotnettools.csharp-2.0.402-gc1f776a5b2/.roslyn/Microsoft.CodeAnalysis.CSharp.dll added to workspace.
dbug: LanguageServerWorkspaceFactory[0]
      Solution-level analyzer at /usr/local/google/home/landonwilkins/.vscode-server/extensions/ms-dotnettools.csharp-2.0.402-gc1f776a5b2/.roslyn/Microsoft.CodeAnalysis.Elfie.dll added to workspace.
dbug: LanguageServerWorkspaceFactory[0]
      Solution-level analyzer at /usr/local/google/home/landonwilkins/.vscode-server/extensions/ms-dotnettools.csharp-2.0.402-gc1f776a5b2/.roslyn/Microsoft.CodeAnalysis.AnalyzerUtilities.dll added to workspace.
dbug: LanguageServerWorkspaceFactory[0]
      Solution-level analyzer at /usr/local/google/home/landonwilkins/.vscode-server/extensions/ms-dotnettools.csharp-2.0.402-gc1f776a5b2/.roslyn/Microsoft.CodeAnalysis.Razor.dll added to workspace.
dbug: LanguageServerWorkspaceFactory[0]
      Solution-level analyzer at /usr/local/google/home/landonwilkins/.vscode-server/extensions/ms-dotnettools.csharp-2.0.402-gc1f776a5b2/.roslyn/Microsoft.CodeAnalysis.CSharp.Features.dll added to workspace.
dbug: LanguageServerWorkspaceFactory[0]
      Solution-level analyzer at /usr/local/google/home/landonwilkins/.vscode-server/extensions/ms-dotnettools.csharp-2.0.402-gc1f776a5b2/.roslyn/Microsoft.CodeAnalysis.Workspaces.MSBuild.dll added to workspace.
dbug: LanguageServerWorkspaceFactory[0]
      Solution-level analyzer at /usr/local/google/home/landonwilkins/.vscode-server/extensions/ms-dotnettools.csharp-2.0.402-gc1f776a5b2/.roslyn/Microsoft.CodeAnalysis.CSharp.Workspaces.dll added to workspace.
[Info  - 10:37:14 PM] [Program]Language server initialized
[LanguageServerHost][10:37:14.365][Start]initialize
[LanguageServerHost][10:37:14.372][Start]Initialize
[LanguageServerHost][10:37:14.453][End]Initialize
[LanguageServerHost][10:37:14.522][End]initialize
[LanguageServerHost][10:37:14.531][Start]initialized
[LanguageServerHost][10:37:14.682][End]initialized
[LanguageServerHost][10:37:14.685][Start]solution/open
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 - 10:37:14 PM] [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.WhereEnumerableIterator`1.MoveNext()
   at System.Linq.Enumerable.TryGetFirst[TSource](IEnumerable`1 source, Boolean& found)
   at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 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.QueueItem`3.StartRequestAsync(TRequestContext context, CancellationToken cancellationToken) in /_/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/QueueItem.cs:line 136
[LanguageServerHost][10:37:14.711][End]solution/open
[LanguageServerHost][10:37:14.713][Start]workspace/diagnostic
[LanguageServerHost]PublicWorkspacePullDiagnosticsHandler(category: ) started getting diagnostics
[LanguageServerHost]previousResults.Length=0
[LanguageServerHost]Processing 0 documents

C# LSP trace logs:

Extension vscode.configuration-editing does not contribute csharpExtensionLoadPaths
Extension vscode.css-language-features does not contribute csharpExtensionLoadPaths
Extension vscode.debug-auto-launch does not contribute csharpExtensionLoadPaths
Extension vscode.debug-server-ready does not contribute csharpExtensionLoadPaths
Extension vscode.emmet does not contribute csharpExtensionLoadPaths
Extension vscode.extension-editing 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.grunt does not contribute csharpExtensionLoadPaths
Extension vscode.gulp does not contribute csharpExtensionLoadPaths
Extension vscode.html-language-features does not contribute csharpExtensionLoadPaths
Extension vscode.ipynb does not contribute csharpExtensionLoadPaths
Extension vscode.jake does not contribute csharpExtensionLoadPaths
Extension vscode.json-language-features does not contribute csharpExtensionLoadPaths
Extension vscode.markdown-language-features does not contribute csharpExtensionLoadPaths
Extension vscode.markdown-math does not contribute csharpExtensionLoadPaths
Extension vscode.merge-conflict does not contribute csharpExtensionLoadPaths
Extension ms-vscode.js-debug does not contribute csharpExtensionLoadPaths
Extension ms-vscode.vscode-js-profile-table does not contribute csharpExtensionLoadPaths
Extension vscode.npm does not contribute csharpExtensionLoadPaths
Extension vscode.php-language-features does not contribute csharpExtensionLoadPaths
Extension vscode.references-view does not contribute csharpExtensionLoadPaths
Extension vscode.search-result does not contribute csharpExtensionLoadPaths
Extension vscode.typescript-language-features does not contribute csharpExtensionLoadPaths
Extension ms-dotnettools.csharp does not contribute csharpExtensionLoadPaths
Extension ms-dotnettools.vscode-dotnet-runtime does not contribute csharpExtensionLoadPaths
Extension ms-python.python does not contribute csharpExtensionLoadPaths
Extension ms-python.vscode-pylance does not contribute csharpExtensionLoadPaths
Extension ms-toolsai.jupyter 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
[Trace - 10:37:14 PM] Sending notification 'initialized'.
Params: {}


[Trace - 10:37:14 PM] Sending notification 'solution/open'.
Params: {
    "solution": "file:///usr/local/google/home/landonwilkins/qc/Virtual Orange Lion/Virtual Orange Lion.sln"
}


[Trace - 10:37:14 PM] Sending request 'workspace/diagnostic - (1)'.
Params: {
    "previousResultIds": [],
    "partialResultToken": "4ca8a96c-b407-4982-9b96-65f6d665ba2a"
}


[Trace - 10:37:14 PM] Received notification 'window/logMessage'.
Params: {
    "type": 4,
    "message": "[LanguageServerHost][10:37:14.522][End]initialize"
}


[Trace - 10:37:14 PM] Received notification 'window/logMessage'.
Params: {
    "type": 4,
    "message": "[LanguageServerHost][10:37:14.531][Start]initialized"
}


[Trace - 10:37:14 PM] Received request 'client/registerCapability - (2)'.
Params: {
    "registrations": [
        {
            "id": "6086b391-133d-45e2-b4d7-8741ce898fef",
            "method": "workspace/didChangeConfiguration"
        }
    ]
}


[Trace - 10:37:14 PM] Sending response 'client/registerCapability - (2)'. Processing request took 0ms
No result returned.


[Trace - 10:37:14 PM] Received request 'workspace/configuration - (3)'.
Params: {
    "items": [
        {
            "section": "csharp|symbol_search.dotnet_search_reference_assemblies"
        },
        {
            "section": "visual_basic|symbol_search.dotnet_search_reference_assemblies"
        },
        {
            "section": "csharp|implement_type.dotnet_insertion_behavior"
        },
        {
            "section": "visual_basic|implement_type.dotnet_insertion_behavior"
        },
        {
            "section": "csharp|implement_type.dotnet_property_generation_behavior"
        },
        {
            "section": "visual_basic|implement_type.dotnet_property_generation_behavior"
        },
        {
            "section": "csharp|completion.dotnet_show_name_completion_suggestions"
        },
        {
            "section": "visual_basic|completion.dotnet_show_name_completion_suggestions"
        },
        {
            "section": "csharp|completion.dotnet_provide_regex_completions"
        },
        {
            "section": "visual_basic|completion.dotnet_provide_regex_completions"
        },
        {
            "section": "csharp|completion.dotnet_show_completion_items_from_unimported_namespaces"
        },
        {
            "section": "visual_basic|completion.dotnet_show_completion_items_from_unimported_namespaces"
        },
        {
            "section": "csharp|quick_info.dotnet_show_remarks_in_quick_info"
        },
        {
            "section": "visual_basic|quick_info.dotnet_show_remarks_in_quick_info"
        },
        {
            "section": "navigation.dotnet_navigate_to_decompiled_sources"
        },
        {
            "section": "csharp|highlighting.dotnet_highlight_related_json_components"
        },
        {
            "section": "visual_basic|highlighting.dotnet_highlight_related_json_components"
        },
        {
            "section": "csharp|highlighting.dotnet_highlight_related_regex_components"
        },
        {
            "section": "visual_basic|highlighting.dotnet_highlight_related_regex_components"
        },
        {
            "section": "csharp|inlay_hints.dotnet_enable_inlay_hints_for_parameters"
        },
        {
            "section": "visual_basic|inlay_hints.dotnet_enable_inlay_hints_for_parameters"
        },
        {
            "section": "csharp|inlay_hints.dotnet_enable_inlay_hints_for_literal_parameters"
        },
        {
            "section": "visual_basic|inlay_hints.dotnet_enable_inlay_hints_for_literal_parameters"
        },
        {
            "section": "csharp|inlay_hints.dotnet_enable_inlay_hints_for_indexer_parameters"
        },
        {
            "section": "visual_basic|inlay_hints.dotnet_enable_inlay_hints_for_indexer_parameters"
        },
        {
            "section": "csharp|inlay_hints.dotnet_enable_inlay_hints_for_object_creation_parameters"
        },
        {
            "section": "visual_basic|inlay_hints.dotnet_enable_inlay_hints_for_object_creation_parameters"
        },
        {
            "section": "csharp|inlay_hints.dotnet_enable_inlay_hints_for_other_parameters"
        },
        {
            "section": "visual_basic|inlay_hints.dotnet_enable_inlay_hints_for_other_parameters"
        },
        {
            "section": "csharp|inlay_hints.dotnet_suppress_inlay_hints_for_parameters_that_differ_only_by_suffix"
        },
        {
            "section": "visual_basic|inlay_hints.dotnet_suppress_inlay_hints_for_parameters_that_differ_only_by_suffix"
        },
        {
            "section": "csharp|inlay_hints.dotnet_suppress_inlay_hints_for_parameters_that_match_method_intent"
        },
        {
            "section": "visual_basic|inlay_hints.dotnet_suppress_inlay_hints_for_parameters_that_match_method_intent"
        },
        {
            "section": "csharp|inlay_hints.dotnet_suppress_inlay_hints_for_parameters_that_match_argument_name"
        },
        {
            "section": "visual_basic|inlay_hints.dotnet_suppress_inlay_hints_for_parameters_that_match_argument_name"
        },
        {
            "section": "csharp|inlay_hints.csharp_enable_inlay_hints_for_types"
        },
        {
            "section": "visual_basic|inlay_hints.csharp_enable_inlay_hints_for_types"
        },
        {
            "section": "csharp|inlay_hints.csharp_enable_inlay_hints_for_implicit_variable_types"
        },
        {
            "section": "visual_basic|inlay_hints.csharp_enable_inlay_hints_for_implicit_variable_types"
        },
        {
            "section": "csharp|inlay_hints.csharp_enable_inlay_hints_for_lambda_parameter_types"
        },
        {
            "section": "visual_basic|inlay_hints.csharp_enable_inlay_hints_for_lambda_parameter_types"
        },
        {
            "section": "csharp|inlay_hints.csharp_enable_inlay_hints_for_implicit_object_creation"
        },
        {
            "section": "visual_basic|inlay_hints.csharp_enable_inlay_hints_for_implicit_object_creation"
        },
        {
            "section": "csharp|code_style.formatting.indentation_and_spacing.tab_width"
        },
        {
            "section": "visual_basic|code_style.formatting.indentation_and_spacing.tab_width"
        },
        {
            "section": "csharp|code_style.formatting.indentation_and_spacing.indent_size"
        },
        {
            "section": "visual_basic|code_style.formatting.indentation_and_spacing.indent_size"
        },
        {
            "section": "csharp|code_style.formatting.indentation_and_spacing.indent_style"
        },
        {
            "section": "visual_basic|code_style.formatting.indentation_and_spacing.indent_style"
        },
        {
            "section": "csharp|code_style.formatting.new_line.end_of_line"
        },
        {
            "section": "visual_basic|code_style.formatting.new_line.end_of_line"
        },
        {
            "section": "code_style.formatting.new_line.insert_final_newline"
        },
        {
            "section": "csharp|background_analysis.dotnet_analyzer_diagnostics_scope"
        },
        {
            "section": "visual_basic|background_analysis.dotnet_analyzer_diagnostics_scope"
        },
        {
            "section": "csharp|background_analysis.dotnet_compiler_diagnostics_scope"
        },
        {
            "section": "visual_basic|background_analysis.dotnet_compiler_diagnostics_scope"
        },
        {
            "section": "csharp|code_lens.dotnet_enable_references_code_lens"
        },
        {
            "section": "visual_basic|code_lens.dotnet_enable_references_code_lens"
        },
        {
            "section": "csharp|code_lens.dotnet_enable_tests_code_lens"
        },
        {
            "section": "visual_basic|code_lens.dotnet_enable_tests_code_lens"
        }
    ]
}


[Trace - 10:37:14 PM] Sending response 'workspace/configuration - (3)'. Processing request took 4ms
Result: [
    true,
    null,
    "withOtherMembersOfTheSameKind",
    null,
    "preferThrowingProperties",
    null,
    "true",
    null,
    "true",
    null,
    true,
    null,
    "true",
    null,
    "true",
    "true",
    null,
    "true",
    null,
    false,
    null,
    false,
    null,
    false,
    null,
    false,
    null,
    false,
    null,
    false,
    null,
    false,
    null,
    false,
    null,
    false,
    null,
    false,
    null,
    false,
    null,
    false,
    null,
    "4",
    null,
    "4",
    null,
    "space",
    null,
    "auto",
    null,
    false,
    "openFiles",
    null,
    "openFiles",
    null,
    true,
    null,
    true,
    null
]


[Trace - 10:37:14 PM] Received notification 'window/logMessage'.
Params: {
    "type": 4,
    "message": "[LanguageServerHost][10:37:14.682][End]initialized"
}


[Trace - 10:37:14 PM] Received notification 'window/logMessage'.
Params: {
    "type": 4,
    "message": "[LanguageServerHost][10:37:14.685][Start]solution/open"
}


[Trace - 10:37:14 PM] Received notification 'window/logMessage'.
Params: {
    "type": 1,
    "message": "[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.\n   at Microsoft.Build.Locator.DotNetSdkLocationHelper.GetDotNetBasePaths(String workingDirectory)+MoveNext()\n   at Microsoft.Build.Locator.DotNetSdkLocationHelper.GetInstances(String workingDirectory)+MoveNext()\n   at Microsoft.Build.Locator.MSBuildLocator.GetInstances(VisualStudioInstanceQueryOptions options)+MoveNext()\n   at System.Linq.Enumerable.WhereEnumerableIterator`1.MoveNext()\n   at System.Linq.Enumerable.TryGetFirst[TSource](IEnumerable`1 source, Boolean& found)\n   at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source)\n   at Microsoft.CodeAnalysis.LanguageServer.HostWorkspace.LanguageServerProjectSystem.TryEnsureMSBuildLoadedAsync(String workingDirectory) in /_/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/HostWorkspace/LanguageServerProjectSystem.cs:line 140\n   at Microsoft.CodeAnalysis.LanguageServer.HostWorkspace.LanguageServerProjectSystem.OpenSolutionAsync(String solutionFilePath) in /_/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/HostWorkspace/LanguageServerProjectSystem.cs:line 78\n   at Microsoft.CommonLanguageServerProtocol.Framework.QueueItem`3.StartRequestAsync(TRequestContext context, CancellationToken cancellationToken) in /_/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/QueueItem.cs:line 136"
}


[Trace - 10:37:14 PM] Received notification 'window/logMessage'.
Params: {
    "type": 4,
    "message": "[LanguageServerHost][10:37:14.711][End]solution/open"
}


[Trace - 10:37:14 PM] Received notification 'window/logMessage'.
Params: {
    "type": 4,
    "message": "[LanguageServerHost][10:37:14.713][Start]workspace/diagnostic"
}


[Trace - 10:37:14 PM] Received notification 'window/logMessage'.
Params: {
    "type": 4,
    "message": "[LanguageServerHost]PublicWorkspacePullDiagnosticsHandler(category: ) started getting diagnostics"
}


[Trace - 10:37:14 PM] Received notification 'window/logMessage'.
Params: {
    "type": 4,
    "message": "[LanguageServerHost]previousResults.Length=0"
}


[Trace - 10:37:14 PM] Received notification 'window/logMessage'.
Params: {
    "type": 4,
    "message": "[LanguageServerHost]Processing 0 documents"
}


[Trace - 10:37:16 PM] Received request 'workspace/diagnostic/refresh - (4)'.
Params: []


[Trace - 10:37:16 PM] Sending response 'workspace/diagnostic/refresh - (4)'. Processing request took 0ms
No result returned.

@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
@dibarbet
Copy link
Member

/bin/sh: line 1: dotnet: command not found

So this seems to indicate it can't find dotnet on the path, but you're able to run dotnet commands from the terminal successfully.

The first thing that comes to mind - since you installed .net7, have you entirely killed and restarted code-server? If not I would suggest trying that.

@landonwilkins
Copy link
Author

I don't know how to kill and restart the code-server, but I just restarted both my mac (host) and my linux machine (remote).

I get the same error:

image

C# logs: https://gist.github.com/landonwilkins/160670a3f7c8de75feef0d21346f303e

C# LSP logs: https://gist.github.com/landonwilkins/4c407dcb9a97f55cfd0580ad32f7702a

@BrianX340
Copy link

BrianX340 commented Aug 31, 2023

This worked for me:

  1. Download the binary from https://dotnet.microsoft.com/en-us/download/dotnet/thank-you/sdk-7.0.400-linux-x64-binaries
  2. I moved the .tar.gz file to the user's home (where the terminal is positioned when you open it)
  3. Run these commands in order in the terminal:
DOTNET_FILE=dotnet-sdk-7.0.100-linux-x64.tar.gz
export DOTNET_ROOT=$(pwd)/.dotnet

mkdir -p "$DOTNET_ROOT" && tar zxf "$DOTNET_FILE" -C "$DOTNET_ROOT"

export PATH=$PATH:$DOTNET_ROOT:$DOTNET_ROOT/tools
  1. Modify the .bashrc by adding to the end:
export DOTNET_ROOT=$(pwd)/.dotnet
export PATH=$PATH:$DOTNET_ROOT:$DOTNET_ROOT/tools

Just in case, before this but it had not worked for me, I used the script that automatically installs everything I leave the link: https://dot.net/v1/dotnet-install.sh -O dotnet-install.sh

Check this too: https://learn.microsoft.com/en-us/dotnet/core/install/linux-scripted-manual#manual-install

@mdd-lipp
Copy link

mdd-lipp commented Sep 13, 2023

Good day everyone

I encountered the same issue but none of the solutions above worked for me. I am using a Windows Host and the Remote SSH option to connect to a Debian Linux machine. We are using the dotnet-install script too, so we have dotnet installed in the default .dotnet folder inside our home directory.

At some point I connected to the machine using SSH to verify that the command to kill the remote server actually works. That's when I recognized that the terminal has no colors, also dotnet is not available and echo $PATH looked rather sad 😄

So, turns out that the .bashrc file is not loaded when connecting over ssh and I configured everything in my .bashrc file. I added this snippet here to ~/.bash_profile (which I had to create first) to source the ~/.bashrc file.

if [ -f ~/.bashrc ]; then
  . ~/.bashrc
fi

After a quick test with a new ssh connection from my windows terminal everything is now properly set up. And VSCode is also happy. Here's the output of the C# extension:

Using dotnet configured on PATH
Dotnet path: /home/<removed>/dotnet
Activating C# standalone...
....

It immediately started to work for me. Hope this helps you too.

Cheers

@landonwilkins
Copy link
Author

I tried both of the solutions above

  1. I tried adding the ~/.bash_profile bit
  2. I tried uninstalling the dotnet installed by dotnet-install script, and reinstalling using BrianX340's method
  3. I tried resetting all the settings

After resetting all the settings, I saw the following in the logs:

ms-dotnettools.csharp requested to download the .NET Runtime.
Downloading .NET version(s) 7.0.11 ...... Done!
.NET 7.0.11 executable path: /usr/local/google/home/landonwilkins/.vscode-server/data/User/globalStorage/ms-dotnettools.vscode-dotnet-runtime/.dotnet/7.0.11/dotnet

So I restarted my remote, hoping I could get it working, but it still says "No .NET SDKS were found": https://gist.github.com/landonwilkins/fd24980336ad79577e86edbe70ed14c0

@mdd-lipp
Copy link

mdd-lipp commented Sep 16, 2023 via email

@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

Coming back to this after a while. Did some testing today and experienced the same issue and fix as mdd-lipp; adding the dotnet installation to the $PATH in ~/.bash_profile resolved the issue (I did have to run the command 'Kill VS Code Server on Host' from VSCode after adding it). Worked when connecting to a remote linux VM from my local Windows and Mac and Linux machines. This matches what others have observed on VSCode remote SSH behavior as well - microsoft/vscode-remote-release#83 (comment)

Unfortunately I'm not sure if there is anything else I can do to help fix this from the extension side. The error:

The .NET Core SDK cannot be located: Error running dotnet --info: Error: Command failed: dotnet --info
/bin/sh: line 1: dotnet: command not found

means that dotnet is not found on the $PATH, so whatever shell is launching the vscode-server process on the remote machine doesn't have dotnet included in $PATH.

And even if we download a local runtime to start the server, we'll still fail later on when we try to load the project because we can't find an SDK, as you see with these logs

[Error - 10:37:14 PM] [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.WhereEnumerableIterator`1.MoveNext()
   at System.Linq.Enumerable.TryGetFirst[TSource](IEnumerable`1 source, Boolean& found)
   at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 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.QueueItem`3.StartRequestAsync(TRequestContext context, CancellationToken cancellationToken) in /_/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/QueueItem.cs:line 136

No idea if this will work - but you could try and find what the $PATH is for the server process and symlink the dotnet executable into a folder that is part of that path.
Locating the server process id:

ps -ef | grep Microsoft.CodeAnalysis.LanguageServer

Then to find the environment variables for the running process:

cat /proc/<processId here>/environ --show-nonprinting | grep PATH

Will output something like
image

@AimadYahyaoui
Copy link

Impossible to use the SDK

I have install sdk 8 and runtime 8 and aspnetcore 8 on my linux
But when i launch vscode and open a net core project i have this error:
Error running dotnet --info: Error: Command failed: dotnet --info /bin/sh: ligne 1: dotnet : commande introuvable /bin/sh: ligne 1: dotnet : commande introuvable .

I'm on fedora workstation 39

Capture d’écran du 2024-01-26 00-18-19

thanks for help

@ybrdev
Copy link

ybrdev commented Mar 27, 2024

As stated on the wiki, launching VSCode from the Terminal resolves the error dialog.

@dibarbet
Copy link
Member

Closing this issue, there isn't a lot we can do on the extension side - dotnet must be installed and available on the $path. See the link above for troubleshooting dotnet availability on the path.

@dibarbet dibarbet closed this as not planned Won't fix, can't repro, duplicate, stale May 22, 2024
@MrJackSpade
Copy link

In case anyone else ends up here, I had the same issue.

Originally I had installed vscode from a flatpack, but when I updated it, it downloaded a .deb instead.

The flatpack version had the problem where it couldn't locate the SDK, but the version installed from the .deb worked perfectly fine.

@VladyslavYesypov
Copy link

@ybrdev answer helped me, running from terminal resolved the issue. I'm on Arch Linux and I have zsh as default shell setup both on system level and in vs code profile, I have all dotnet related env variables setup properly in .zshrc, but for some reason when I run vs code not from the terminal it uses /bin/sh to run tasks instead of zsh.

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-Configuration Issue
Projects
None yet
Development

No branches or pull requests

9 participants