dotnet / sdk

Core functionality needed to create .NET Core projects, that is shared between Visual Studio and CLI
https://dot.net/core
MIT License
2.71k stars 1.06k forks source link

Installing DotNet CLI via winget not working - Dotnet CLI missing #41878

Open CalaxDev opened 4 months ago

CalaxDev commented 4 months ago

Describe the bug

I used the winget command winget install Microsoft.DotNet.SDK.8 to install .NET 8 on a fresh windows install, but it failed to install the dotnet cli. It created the dotnet folder under C:\Program Files\dotnet but the executable is missing. image

To Reproduce

Exceptions (if any)

No errors occured

Further technical details

baronfel commented 4 months ago

cc @leecow who's a good contact for WinGet to do initial triage?

CalaxDev commented 4 months ago

I also tried via Visual Studio but this results in another problematic install.

image image

It creates the dotnet folder in Program Files and Program Files (x86) but only in Program Files(x86) it adds the dotnet.exe - None of which get added to my Path variable. According to all documentation found online the dotnet.exe should be in "Program Files" (and added to path but I could do that manually)

Am I doing something wrong? How can I get the dotnet cli to run and detect my installed SDKs?

leecow commented 4 months ago

@mthalman and @lbussell

mthalman commented 4 months ago

There's nothing special about WinGet here. It's just using the MSI installer. /cc @joeloff

CalaxDev commented 4 months ago

I've used the MSI installer I've taken from the WinGet cache and installed it that way as well, resulting in the behavior I showed in subsequent pics.

After installing VS 2022, it brought along it's own x64 dotnet.exe (in a path not being Program Files, also not setting the path env var - thus not being available, even inside the VS terminal) and I copied this over into my non-x86 Program Files and I can now use the dotnet cli

I assume there's something weird going on with the MSI installer not placing the dotnet.exe into the Program Files folder and subsequently failing to set the env path variable?

marcpopMSFT commented 3 months ago

Definitely something strange going on with your install. My guess is that VS didn't work because it uses the same msi as winget and so it didn't actually try to install .NET. Maybe try a repair in VS or if you can uninstall through add-remove programs first of any .NET versions installed from winget.