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.35k stars 1.45k forks source link

`Repair-WinGetPackageManager` doesn't work on sandbox with `-IncludePrerelease` flag #4903

Closed mdanish-kh closed 3 weeks ago

mdanish-kh commented 1 month ago

Brief description of your issue

Repair-WinGetPackageManager can be used to boostrap WinGet on a clean / sandbox environment. It appears that trying to install a preview version of WinGet with -Prerelease flag causes it to throw a missing dependency error on sandbox. Note that the command works fine without the pre-release flag

Steps to reproduce

Use the following commands in a sandbox environment

$progressPreference = 'silentlyContinue'
Install-PackageProvider -Name NuGet -Force | Out-Null
Install-Module -Name Microsoft.WinGet.Client -Force -Repository PSGallery | Out-Null
Repair-WinGetPackageManager -IncludePrerelease

Expected behavior

Cmdlet successfully installs the latest preview version of the client

Actual behavior

Command errors out complaining that Microsoft.VCLibs.140.00.UWPDesktop dependency is missing

Add-AppxPackage : Deployment failed with HRESULT: 0x80073CF3, Package failed updates, dependency or conflict
validation.
Windows cannot install package Microsoft.DesktopAppInstaller_1.24.25170.0_x64__8wekyb3d8bbwe because this package
depends on a framework that could not be found. Provide the framework "Microsoft.VCLibs.140.00.UWPDesktop" published
by "CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US", with neutral or x64 processor
architecture and minimum version 14.0.33728.0, along with this package to install.
NOTE: For additional information, look for [ActivityId] 24bc3c11-264f-0006-59eb-bc244f26db01 in the Event Log or use
the command line Get-AppPackageLog -ActivityID 24bc3c11-264f-0006-59eb-bc244f26db01
At line:6 char:1
+ Repair-WinGetPackageManager -IncludePrerelease
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : WriteError: (C:\Users\WDAGUt...bbwe.msixbundle:String) [Add-AppxPackage], IOException
    + FullyQualifiedErrorId : DeploymentError,Microsoft.Windows.Appx.PackageManager.Commands.AddAppxPackageCommand

Environment

Windows Sandbox Microsoft.WinGet.Client version 1.9.2411

Trenly commented 1 month ago

I believe this is because the URL for VCLibs points to an older release than the one WinGet requires. If I had to guess, the VCLibs team needs to update that URL to point to the new version

denelon commented 1 month ago

This looks like the UWP Desktop version of the VCLibs package. We've been working to get a distinct versioned URL for this package.

denelon commented 3 weeks ago

I think we've fixed this with the new version of the PowerShell module that was just published.

Let me know if this works or not.

mdanish-kh commented 3 weeks ago

Works now! Not able to repro the issue anymore