muhammadsammy / free-vscode-csharp

Free/Libre fork of the official C# extension for vscode
https://open-vsx.org/extension/muhammad-sammy/csharp
Other
110 stars 10 forks source link

Cannot find dotnet path #58

Open Dreamoochy opened 10 months ago

Dreamoochy commented 10 months ago

I have a portable VSCodium (1.82) and portable dotnet sdk (7.0.400). VSCodium is launched via custom cmd-file where DOTNET_ROOT environment variable is set.

In the VSCodium settings there're the following lines:

  "dotnetAcquisitionExtension.existingDotnetPath": [
      {
        "extensionId": "muhammad-sammy.csharp",
        "path": "${env:DOTNET_ROOT}/dotnet.exe"
      }
  ],

When I launch VSCodum, I get an error:

Failed to find dotnet info from path, falling back to acquire runtime via ms-dotnettools.vscode-dotnet-runtime
Could not find extension target platform in %vscodium_path%\data\extensions\muhammad-sammy.csharp-2.0.436\.vsixmanifest
[Error - 8:06:48 PM] Microsoft.CodeAnalysis.LanguageServer client: couldn't create connection to server.
Error: Cannot find dotnet path '${env:DOTNET_ROOT}\dotnet.exe'
    at t.DotnetRuntimeExtensionResolver.<anonymous> (%vscodium_path%\data\extensions\muhammad-sammy.csharp-2.0.436\dist\extension.js:2:1128383)
    at Generator.next (<anonymous>)
    at s (%vscodium_path%\data\extensions\muhammad-sammy.csharp-2.0.436\dist\extension.js:2:1127327)

I can't remember such a behaviour with the previous versions 1.2x. But I'm not sure it's a free-omnisharp issue.

KarthikHebbarMN commented 9 months ago

Similar issue, I have a coder-server with dotnet (tried both with 6 and 7) installed, and when I try to install the c# extension it installs and when attempted to load a .cs file it says Failed to find dotnet info from path, falling back to acquire runtime via ms-dotnettools.vscode-dotnet-runtime Could not find extension target platform in...

Rebjai commented 9 months ago

I had the same issue but solved it by manually putting the path in the extension config, hope it helps

get sdk path

dotnet --list-sdks

image

Extensions> C# configuration: image

Dreamoochy commented 9 months ago

I had the same issue but solved it by manually putting the path in the extension config

Thanks, it works. Partially.

  1. It works with the direct paths only, it doesn't recognize paths with environment variables like ${env:DOTNET_ROOT} (or I don't know how to use it properly). And I need it to keep the portability (on MS Windows).
  2. It ends up with the "undefined" is not valid json issue.
Rikitik commented 8 months ago

I'm having issues ith this as well . I'm interested how you made it portable on a USB flashdrive?

Dreamoochy commented 8 months ago

I'm having issues ith this as well . I'm interested how you made it portable on a USB flashdrive?

To be honest, it's not really portable. Basically it's just able to run from a USB. I've created start.cmd file which sets some session environment variables (dotnet, powershell etc) and adds them to PATH.