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

[BUG] dotnet location not respecting existingDotnetPath #1466

Open
rithvik-bosch opened this issue Sep 13, 2024 · 1 comment
Open

[BUG] dotnet location not respecting existingDotnetPath #1466

rithvik-bosch opened this issue Sep 13, 2024 · 1 comment
Labels
area-dotnet-acquisition bug Something isn't working

Comments

@rithvik-bosch
Copy link

rithvik-bosch commented Sep 13, 2024

Describe the Issue

dotnet installed in Program Files only has sdk 6, while I need 8. Without admin rights, it's not possible to install sdk 8 in it. So I'm trying to set a custom location for the dotnet SDK.

It seems like the new location is picked up but nuget still uses the dotnet.exe from PATH (which I can't modify since it's a system env var).

Specifically this line: Found installed dotnet location "C:\Program Files\dotnet\dotnet.exe" to load projects.
is not respecting the custom location C:\Users\username\AppData\Local\dotnet-sdk-8.0.401-win-x64\dotnet.exe

Steps To Reproduce

SDK 6 installed at default location
SDK 8 installed at a custom location
vscode settings set:

{
  "dotnetAcquisitionExtension.sharedExistingDotnetPath": "C:\\Users\\username\\AppData\\Local\\dotnet-sdk-8.0.401-win-x64\\dotnet.exe",
  "dotnet.dotnetPath": "C:\\Users\\username\\AppData\\Local\\dotnet-sdk-8.0.401-win-x64",
  "dotnetAcquisitionExtension.existingDotnetPath": [
    {
      "extensionId": "ms-dotnettools.csdevkit",
      "path": "C:\\Users\\username\\AppData\\Local\\dotnet-sdk-8.0.401-win-x64\\dotnet.exe"
    },
    {
      "extensionId": "ms-dotnettools.vscodeintellicode-csharp",
      "path": "C:\\Users\\username\\AppData\\Local\\dotnet-sdk-8.0.401-win-x64\\dotnet.exe"
    },
    {
      "extensionId": "ms-dotnettools.csharp",
      "path": "C:\\Users\\username\\AppData\\Local\\dotnet-sdk-8.0.401-win-x64\\dotnet.exe"
    },
    {
      "extensionId": "ms-dotnettools.vscode-dotnet-runtime",
      "path": "C:\\Users\\username\\AppData\\Local\\dotnet-sdk-8.0.401-win-x64\\dotnet.exe"
    }
  ],
  "omnisharp.sdkPath": "C:\\Users\\username\\AppData\\Local\\dotnet-sdk-8.0.401-win-x64\\sdk\\8.0.401",
  "omnisharp.dotNetCliPaths": [
    "C:\\Users\\username\\AppData\\Local\\dotnet-sdk-8.0.401-win-x64\\dotnet.exe"
  ]
}

C# Dev Kit Log:

Starting Spawn .NET server...
Starting opening a solution...
Starting processing the solution file "c:\Users\username\Documents\Projects\project\.project.sln" in Dev Kit server...
Using local .NET runtime at "C:\Users\username\AppData\Local\dotnet-sdk-8.0.401-win-x64\dotnet.exe"
Found installed dotnet location "C:\Program Files\dotnet\dotnet.exe" to load projects.
.NET server started and IPC established in 1279ms
Completed Spawn .NET server (4834ms)
Completed processing the solution file "c:\Users\username\Documents\Projects\project\.project.sln" in Dev Kit server (6164ms)
Starting restoring NuGet packages...
Selected configuration: <Default>, active configuration: Debug|Any CPU
Completed opening a solution (6176ms)
Starting command: "dotnet.exe" restore C:\Users\username\Documents\Projects\project\.project.sln --interactive...
Failed at 'command: "dotnet.exe" restore C:\Users\username\Documents\Projects\project\.project.sln --interactive' (1113ms) with error: ExitCodeError: Failed with ExitCode(1)
Completed NuGet restore with error: DotnetCommandRestoreError: Failed with ExitCode(1)
Completed restoring NuGet packages (1117ms)

NuGet log:

  Determining projects to restore...
C:\Program Files\dotnet\sdk\6.0.424\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets(144,5): error NETSDK1045: The current .NET SDK does not support targeting .NET 8.0.  Either target .NET 6.0 or lower, or use a version of the .NET SDK that supports .NET 8.0. [C:\Users\username\Documents\Projects\project\project\project.csproj]

Specifically this line: Found installed dotnet location "C:\Program Files\dotnet\dotnet.exe" to load projects.
is not respecting the custom location C:\Users\username\AppData\Local\dotnet-sdk-8.0.401-win-x64\dotnet.exe

Expected Behavior

It should use C:\Users\username\AppData\Local\dotnet-sdk-8.0.401-win-x64\dotnet.exe.

Environment Information

  • OS: Windows 10
  • vscode: Version: 1.90.1
  • Extension: C# Dev Kit v1.10.1
@rithvik-bosch rithvik-bosch added the bug Something isn't working label Sep 13, 2024
@nagilson
Copy link
Member

related dotnet/vscode-dotnet-runtime#1824

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-dotnet-acquisition bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants