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
22.75k stars 1.41k forks source link

The `Update-WinGetPackage` command fails with an error #4136

Open RalfReddings opened 6 months ago

RalfReddings commented 6 months ago

Brief description of your issue

I am not able to update installed packages by either piping package names to Update-WinGetPackage or using the command directly

Steps to reproduce

I am using the version 0.2.2 of winget.

Find-WinGetPackage Microsoft.VisualStudioCode -Source winget

Name                                      Id                                      Version Source
----                                      --                                      ------- ------
Microsoft Visual Studio Code              Microsoft.VisualStudioCode              1.86.0  winget
Microsoft Visual Studio Code Insiders CLI Microsoft.VisualStudioCode.Insiders.CLI 1.87.0  winget
Microsoft Visual Studio Code Insiders     Microsoft.VisualStudioCode.Insiders     1.87.0  winget
Microsoft Visual Studio Code CLI          Microsoft.VisualStudioCode.CLI          1.86.0  winget

Attempting to install the first one, Microsoft Visual Studio Code, returns an error (I think):

Find-WinGetPackage Microsoft.VisualStudioCode -source winget| Select-Object -First 1 | Update-WinGetPackage

CorrelationData    :
InstallerErrorCode : 0
ExtendedErrorCode  : System.Runtime.InteropServices.COMException (0x8A150002): 0x8A150002
RebootRequired     : False
Status             : InvalidOptions

Starting Code and checking about confirms that it was not updated. I also tried using Update-WinGetPackage directly, I end up with the same above issue:

Update-WinGetPackage Microsoft.VisualStudioCode -Source winget

CorrelationData    :
InstallerErrorCode : 0
ExtendedErrorCode  : System.Runtime.InteropServices.COMException (0x8A150002): 0x8A150002
RebootRequired     : False
Status             : InvalidOptions

Expected behavior

Update the visual studio code application

Actual behavior

I get an error (mentioned above)

Environment

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

Windows: Windows.Desktop v10.0.22621.2134
System Architecture: X64
Package: Microsoft.DesktopAppInstaller v1.21.3133.0

Winget Directories
------------------------------------------------------------------------------------------------------------------------
Logs                               %LOCALAPPDATA%\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\DiagO…
User Settings                      %LOCALAPPDATA%\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\setti…
Portable Links Directory (User)    %LOCALAPPDATA%\Microsoft\WinGet\Links
Portable Links Directory (Machine) C:\Program Files\WinGet\Links
Portable Package Root (User)       %LOCALAPPDATA%\Microsoft\WinGet\Packages
Portable Package Root              C:\Program Files\WinGet\Packages
Portable Package Root (x86)        C:\Program Files (x86)\WinGet\Packages
Installer Downloads                %USERPROFILE%\Downloads

Links
---------------------------------------------------------------------------
Privacy Statement   https://aka.ms/winget-privacy
License Agreement   https://aka.ms/winget-license
Third Party Notices https://aka.ms/winget-3rdPartyNotice
Homepage            https://aka.ms/winget
Windows Store Terms https://www.microsoft.com/en-us/storedocs/terms-of-sale

Admin Setting                             State
--------------------------------------------------
LocalManifestFiles                        Disabled
BypassCertificatePinningForMicrosoftStore Disabled
InstallerHashOverride                     Disabled
LocalArchiveMalwareScanOverride           Disabled
denelon commented 6 months ago

We've released a newer version of the Microsoft.WinGet.Client PowerShell module: https://www.powershellgallery.com/packages/Microsoft.WinGet.Client/1.6.3133.0

There were some changes/improvements in the WinGet COM APIs. Upgrading the module should address this issue.

RalfReddings commented 6 months ago

@denelon

Hey thanks, I installed the new version you mentioned and tested. I just wanted to confirm that it too is suffering the same issue.

 Get-Module -name *wing*

ModuleType Version    PreRelease Name                                ExportedCommands
---------- -------    ---------- ----                                ----------------
Binary     1.6.3133.0            Microsoft.WinGet.Client             {Add-WinGetSource,

I updated Code earlier so I tried updating teracopy:

Get-WinGetPackage teracopy

Name     Id                  Version Available Source
----     --                  ------- --------- ------
TeraCopy CodeSector.TeraCopy 3.9.2   3.17      winget

And attempting to update it:

Get-WinGetPackage teracopy | Update-WinGetPackage

CorrelationData    :
InstallerErrorCode : 0
ExtendedErrorCode  : System.Runtime.InteropServices.COMException (0x80072EFD): 0x80072EFD
RebootRequired     : False
Status             : InternalError
Trenly commented 5 months ago

@ralfreddings - I was able to find a workaround by specifying -Property Id with the Select-Object

PS C:\Users\Trenly> Find-WinGetPackage Notepad++ -source winget| Select-Object -First 1| Update-WinGetPackage

Id                  Name      Source InstallerErrorCode Status         RebootRequired ExtendedErrorCode
--                  ----      ------ ------------------ ------         -------------- -----------------
Notepad++.Notepad++ Notepad++ winget 0                  InvalidOptions False          System.Runtime.InteropServices.C…

PS C:\Users\Trenly> Find-WinGetPackage Notepad++ -source winget| Select-Object -First 1 -Property Id| Update-WinGetPackage

Id                  Name      Source InstallerErrorCode Status RebootRequired ExtendedErrorCode CorrelationData
--                  ----      ------ ------------------ ------ -------------- ----------------- ---------------
Notepad++.Notepad++ Notepad++ winget 0                  Ok     False
kdpuvvadi commented 3 months ago

It's working on some packages but failing on some

$ Find-WinGetPackage Warp -source winget | Select-Object -Property Id -First 1 | Update-WinGetPackage  | Format-List

Id                 : Cloudflare.Warp
Name               : Cloudflare WARP
Source             : winget
CorrelationData    :
InstallerErrorCode : 0
ExtendedErrorCode  : System.Runtime.InteropServices.COMException (0x80070652)
RebootRequired     : False
Status             : InternalError

$ Find-WinGetPackage CMake -source winget | Select-Object -Property Id -First 1 | Update-WinGetPackage  | Format-List

Id                 : Kitware.CMake
Name               : CMake
Source             : winget
CorrelationData    :
InstallerErrorCode : 0
ExtendedErrorCode  :
RebootRequired     : False
Status             : Ok