muhammadsammy/free-vscode-csharp

Cannot find dotnet path

Dreamoochy opened this issue · 5 comments

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.

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

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

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.

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

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.