winget-cli icon indicating copy to clipboard operation
winget-cli copied to clipboard

`Update-WinGetPackage -WhatIf`: Installs the update instead of saying what it would do

Open schittli opened this issue 1 year ago • 2 comments

Brief description of your issue

If one starts Update-WinGetPackage -WhatIf then it installs the update instead of saying what it would do

Steps to reproduce

Just start Update-WinGetPackage -WhatIf for any package

Expected behavior

Of course, as is always the case with PowerShell: A CmdLet only shows what it would do. (Do we need to explain this to Microsoft? I wonder that Microsoft does not have unit-tests for default parameters.)

Actual behavior

If one starts Update-WinGetPackage -WhatIf then it installs the update instead of saying what it would do

Environment

Windows Package Manager v1.8.1791
Windows: Windows.Desktop v10.0.19045.2006
System Architecture: X64
Package: Microsoft.DesktopAppInstaller v1.23.1791.0

schittli avatar Jul 08 '24 19:07 schittli

This is also true of Install-WingetPackage. I ran install-wingetpackage git.git -Verbose -WhatIf and it installed Git . This is a MAJOR issue.

jdhitsolutions avatar Aug 09 '24 16:08 jdhitsolutions

On a related note, commands like Repair-WingetPackageManager should also support -WhatIf because they are changing the state of the system. Commands should have decent verbose output so that if I run Repair-WingetPackageManager -verbose -whatIf I can see exactly what will change.

jdhitsolutions avatar Aug 09 '24 16:08 jdhitsolutions

For Update-WinGetPackage what would you expect the output to be?

Something like:

PS C:\> Update-WinGetPackage Microsoft.PowerShell -WhatIf
What if: Update Microsoft.PowerShell version 7.4.4.0 to Microsoft PowerShell version 7.4.5.0

Would you expect it to be the WinGet Package identifier "Microsoft.PowerShell", or the value in Apps and Features? In this case it would just be PowerShell.

denelon avatar Sep 06 '24 15:09 denelon

This is still a MAJOR issue. It should not download anything, nor should it install anything if I pass -WhatIf. It should show the package name, the version to be installed and the source.

jdhitsolutions avatar Feb 07 '25 16:02 jdhitsolutions