microsoft / winget-cli

WinGet is the Windows Package Manager. This project includes a CLI (Command Line Interface), PowerShell modules, and a COM (Component Object Model) API (Application Programming Interface).
https://learn.microsoft.com/windows/package-manager/
MIT License
23.27k stars 1.45k forks source link

Upgrading Microsoft.DotNet.SDK.7 leaves older version in the system and makes new one not fully visible to winget #2971

Open przemoc opened 1 year ago

przemoc commented 1 year ago

Brief description of your issue

Upgrading Microsoft.DotNet.SDK.7 via winget (that was in the past also installed via winget) leaves older version in the system and makes new one not fully visible to winget.

Steps to reproduce

Having Microsoft.DotNet.SDK.6 already installed may or may not matter (hard to tell). Upgrade Microsoft.DotNet.SDK.7 via winget upgrade --all. (winget upgrade Microsoft.DotNet.SDK.7 would possibly give the same result.)

Expected behavior

Older Microsoft.DotNet.SDK.7 is uninstalled. Newer Microsoft.DotNet.SDK.7 is installed. Microsoft.DotNet.SDK.7 remains fully visible/controllable from winget.

Actual behavior

Older Microsoft.DotNet.SDK.7 is not uninstalled. Newer Microsoft.DotNet.SDK.7 is installed.

http://paste.przemoc.net/winget/WinGet-2023-02-15-11-59-13.872.log - log from winget upgrade --all (I do not have terminal dump as I did not expect issues, so wasn't as cautious as I should be)

image

Microsoft.DotNet.SDK.7 is seemingly not visible from winget.

PS> winget list Microsoft.DotNet.SDK
Name                             Id                     Version Source
-----------------------------------------------------------------------
Microsoft .NET SDK 6.0.406 (x64) Microsoft.DotNet.SDK.6 6.0.406 winget

But shows up in full list:

PS> winget list | findstr Microsoft.DotNet.SDK
Microsoft .NET SDK 7.0.102 (x64)              Microsoft.DotNet.SDK.7                         7.0.102            winget
Microsoft .NET SDK 7.0.200 (x64)              Microsoft.DotNet.SDK.7                         7.0.200            winget
Microsoft .NET SDK 6.0.406 (x64)              Microsoft.DotNet.SDK.6                         6.0.406            winget

And still shows up in upgrade:

PS> winget upgrade
Name                             Id                     Version Available Source
--------------------------------------------------------------------------------
Microsoft .NET SDK 7.0.102 (x64) Microsoft.DotNet.SDK.7 7.0.102 7.0.200   winget
1 upgrades available.

Environment

Windows Package Manager v1.4.10173
Copyright (c) Microsoft Corporation. All rights reserved.

Windows: Windows.Desktop v10.0.22621.1265
System Architecture: X64
Package: Microsoft.DesktopAppInstaller v1.19.10173.0

Logs: %LOCALAPPDATA%\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\DiagOutputDir

User Settings: %LOCALAPPDATA%\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\settings.json
denelon commented 1 year ago

We have an experimental feature to "Uninstall Previous". Run winget features to see if it is enabled. It can be enabled via winget settings.

przemoc commented 1 year ago

Just wanted to let you know that recently and today I was upgrading Microsoft.DotNet.SDK.6 and Microsoft.DotNet.SDK.7 via winget and there were no remnants of older versions afterward. Not sure what changed since then. I was not enabling any experimental features.

przemoc commented 1 year ago

Correcting my previous statement, because maybe I simply forgot I uninstalled them manually back then, not sure... Today I did winget upgrade Microsoft.DotNet.SDK.7 while having 7.0.203 and it installed 7.0.302, but old version remained.

PS> winget list | findstr DotNet.SDK.7
Microsoft .NET SDK 7.0.302 (x64)              Microsoft.DotNet.SDK.7                         7.0.302            winget
Microsoft .NET SDK 7.0.203 (x64)              Microsoft.DotNet.SDK.7                         7.0.203            winget
przemoc commented 1 year ago

It's like back and forth with this. Today upgrade didn't leave any old .NET afterward, which I also confirmed by looking at Installed apps (or control appwiz.cpl). Not sure if my reports have any value at this point.

PowerShell 7.3.5
PS C:\Users\przemoc> winget upgrade
Name                             Id                     Version  Available Source
---------------------------------------------------------------------------------
Microsoft .NET SDK 7.0.304 (x64) Microsoft.DotNet.SDK.7 7.0.304  7.0.305   winget
MSYS2                            MSYS2.MSYS2            20221216 20230526  winget
Microsoft .NET SDK 6.0.410 (x64) Microsoft.DotNet.SDK.6 6.0.410  6.0.411   winget
3 upgrades available.
1 package(s) have version numbers that cannot be determined. Use --include-unknown to see all results.
PS C:\Users\przemoc> winget upgrade Microsoft.DotNet.SDK.6
Found Microsoft .NET SDK 6.0 [Microsoft.DotNet.SDK.6] Version 6.0.411
This application is licensed to you by its owner.
Microsoft is not responsible for, nor does it grant any licenses to, third-party packages.
Downloading https://dotnetcli.azureedge.net/dotnet/Sdk/6.0.411/dotnet-sdk-6.0.411-win-x64.exe
  ██████████████████████████████   197 MB /  197 MB
Successfully verified installer hash
Starting package install...
Successfully installed
PS C:\Users\przemoc> winget upgrade Microsoft.DotNet.SDK.7
Found Microsoft .NET SDK 7.0 [Microsoft.DotNet.SDK.7] Version 7.0.305
This application is licensed to you by its owner.
Microsoft is not responsible for, nor does it grant any licenses to, third-party packages.
Downloading https://dotnetcli.azureedge.net/dotnet/Sdk/7.0.305/dotnet-sdk-7.0.305-win-x64.exe
  ██████████████████████████████   202 MB /  202 MB
Successfully verified installer hash
Starting package install...
Successfully installed
PS C:\Users\przemoc> winget upgrade
Name  Id          Version  Available Source
-------------------------------------------
MSYS2 MSYS2.MSYS2 20221216 20230526  winget
1 upgrades available.
1 package(s) have version numbers that cannot be determined. Use --include-unknown to see all results.
o-l-a-v commented 6 months ago

Still a problem, tested with Winget v1.7.11261 and v1.8.1133-preview.

image

However, winget list --id Microsoft.DotNet.SDK.8 only lists the newest version.

image

While winget list shows both versions:

image

Strange. I'll pin Dotnet SDK for now. But would be great with a fix to this.

PckgrTom commented 3 months ago

Having a similar issue here.

image