microsoft / vscode-dotnettools

This is a feedback repository to capture issues logged for the C# Dev Kit and related extensions from Visual Studio Code
Other
227 stars 11 forks source link

[BUG] existingDotnetPath setting is ignored if the tool autodetects preinstalled runtime #784

Open ineternet opened 10 months ago

ineternet commented 10 months ago

Describe the Issue

Like described in #314 or #138 I put the existingDotnetPath setting in my settings.json, but the tool detects a dotnet somewhere else, and uses that. This is an issue for me because this other dotnet doesn't have the correct SDKs installed.

Starting Spawn .NET server...
Starting Open a solution...
Starting Open a solution with environment service...
Starting Clear environment...
Using preinstalled .NET runtime at "C:\Program Files\dotnet\dotnet.exe"
.NET server started and IPC established in 2812ms

Steps To Reproduce

settings.json:

{
    "dotnetAcquisitionExtension.existingDotnetPath": [
        {
            "extensionId": "ms-dotnettools.csdevkit",
            "path": "C:\\Users\\User\\AppData\\Local\\Microsoft\\dotnet\\dotnet.exe"
        },
        //ms-dotnettools.vscodeintellicode-csharp, ms-dotnettools.csharp, ms-dotnettools.vscode-dotnet-runtime
    ]
}

Expected Behavior

Either the option existingDotnetPath should take precedence, or there needs to be a way to make it stop autodetecting preinstalled SDKs and force a download.

Environment Information

VS Code: 1.84.2 (user setup) C# extension: v2.12.19 C# Dev Kit extension: v1.0.14 .NET Install Tool: v2.0.0

nagilson commented 6 months ago

@arkalyanms @AArnott @lifengl Which do you think should take preference here? I agree with the user that the explicit setting should take preference, in which case this would need to be changed in the CDK .NET Selection code.

ineternet commented 6 months ago

Personally, I don't have this issue anymore because I was able to change the location of the preferred dotnet install in PATH. But that assumes an environment where you can do this just to make one workspace/project work. Might not be ideal if you are working on multiple things at once that each require a different dotnet install.

arkalyanms commented 5 months ago

+1 on the explicit setting taking precendence. @nagilson would you work with @lifengl to drive closure?

nagilson commented 5 months ago

I would be happy to do so 😄