microsoft/winget-cli

Document workaround for Microsoft.UI.Xaml dependency

jedieaston opened this issue ยท 38 comments

Brief description of your issue

The latest pre-release version of winget requires Microsoft.UI.Xaml version 2.7, which doesn't have an external (no MSStore) download link. As such, it's impossible to install on Windows Sandbox or LTSC builds of Windows.

image

Steps to reproduce

  1. Open a Windows Sandbox.
  2. Go to releases and download the latest pre-release version of winget/DesktopAppInstaller.
  3. Download the desktop bridge package from here.
  4. Install the pre-release version of winget, supplying the desktop bridge package as a dependency.

Expected behavior

winget to install, with the dependency support stuff ready to test!

Actual behavior

Add-AppxPackage : Deployment failed with HRESULT: 0x80073CF3, Package failed updates, dependency or conflict validation.
Windows cannot install package Microsoft.DesktopAppInstaller_1.17.3411.0_x64__8wekyb3d8bbwe because this package depends on a framework that could not be found. Provide the framework
"Microsoft.UI.Xaml.2.7" published by "CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US", with neutral or x64 processor architecture and minimum version
7.2109.13004.0, along with this package to install. The frameworks with name "Microsoft.UI.Xaml.2.7" currently installed are: {}
NOTE: For additional information, look for [ActivityId] 5730573a-07cf-000f-f88c-3057cf07d801 in the Event Log or use the command line Get-AppPackageLog -ActivityID
5730573a-07cf-000f-f88c-3057cf07d801
At line:1 char:1
+ Add-AppxPackage .\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbun ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : WriteError: (C:\Users\WDAGUt...bbwe.msixbundle:String) [Add-AppxPackage], IOException
    + FullyQualifiedErrorId : DeploymentError,Microsoft.Windows.Appx.PackageManager.Commands.AddAppxPackageCommand

PS C:\Users\WDAGUtilityAccount\Downloads>

(And before someone says it, yes I know how to get stuff from the Store for offline installation. But that's not the kosher method, and I'd rather someone ask the team that packages Microsoft.UI.Xaml to make it available at a URL like the Desktop Bridge team did.)

Environment

Windows: Windows.Desktop v10.0.22000.434

Any other software? This is the Sandbox build of Windows, so there is not a Microsoft Store available.

I found a workaround that doesn't involve the Store:

  1. Download this NuGetPackage: https://www.nuget.org/packages/Microsoft.UI.Xaml/
  2. Unzip it (change file extension if needed to .zip)
  3. Go to .\tools\AppX\{arch}\Release\Microsoft.UI.Xaml.2.7.appx and install it.

I would much prefer to have a direct link to just the appx file (like for the Desktop Bridge) but this satisfies it in a relatively kosher way.

I have the same issue

After Install Microsoft.UI.Xaml.2.7 I got another problem

Add-AppxPackage : Deployment failed with HRESULT: 0x80073CF3, Package failed updates, dependency or conflict
validation.
Windows cannot install package Microsoft.DesktopAppInstaller_1.17.10271.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.30035.0, along with this package to install. The frameworks with name
"Microsoft.VCLibs.140.00.UWPDesktop" currently installed
Windows cannot install package Microsoft.DesktopAppInstaller_1.17.10271.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.30035.0, along with this package to install. The frameworks with name
"Microsoft.VCLibs.140.00.UWPDesktop" currently installed are: {}
NOTE: For additional information, look for [ActivityId] 796d5a7d-3afd-0000-33ef-6d79fd3ad801 in the Event Log or use
the command line Get-AppPackageLog -ActivityID 796d5a7d-3afd-0000-33ef-6d79fd3ad801
    + CategoryInfo          : WriteError: (C:\Users\Admini...bbwe.msixbundle:String) [Add-AppxPackage], IOException
    + FullyQualifiedErrorId : DeploymentError,Microsoft.Windows.Appx.PackageManager.Commands.AddAppxPackageCommand

@jedieaston is there a similar URL for Winget itself?
Specifically the latest pre-release builds.
Maybe something along the lines of https://github.com/microsoft/winget-cli/releases/pre-release/download
Is this it?

After Install Microsoft.UI.Xaml.2.7 I got another problem

I also ran into this.

Edit: fixed 2nd issue by running

 Add-AppxPackage 'https://aka.ms/Microsoft.VCLibs.x64.14.00.Desktop.appx'

1st issue is still there.

Latest pre-release build of WinGet can be found at https://github.com/microsoft/winget-cli/releases

^ Direct URL: https://github.com/microsoft/winget-cli/releases/download/v1.3.1872/Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle

Microsoft.UI.Xaml.2.7 can be downloaded from https://globalcdn.nuget.org/packages/microsoft.ui.xaml.2.7.0.nupkg and then extract Microsoft.UI.Xaml.2.7.appx from tools\AppX\x64\Release and sideload (via Add-AppxPackage or via App Installer GUI) that onto your PC.

But the "v1.3.1872" bit will change with next update.
I want one that'll always give the latest possible release (pre-release or not).

You will have to do what @vedantmgoyal2009 is doing by using the GitHub API and then getting the latest pre-release build or the latest release build of WinGet.

Each GitHub Releases has a prerelease flag so you can filter which build you want and which you don't want. If a GitHub Release is marked as pre-release then it's "prerelease": true; otherwise it's "prerelease": false

Without the GitHub API it only allows you to download the latest release build (instead of the latest pre-release build) via a special URL at https://github.com/microsoft/winget-cli/releases/latest which is from 2nd of February 2022.

Thanks Levvie.
Is there a reason I shouldn't just grab the first entry in the response body, since that seems to always be the latest prerelease, which is what I want?

Nope. If the latest release is marked as stable you'll get that one, but that's usually the latest one so you should be okay.

Gotcha thanks!

I was able to get things working yesterday, but now it broke out of nowhere.
I traced it back to a new Xaml version which was released 12 hours ago.

So to clarify: when you say Xaml.2.7, do you mean 2.7.0 from 2021 or 2.7.1 from 4 months ago?
It's definitely not 2.8 because like I said that causes winget to fail to install, whereas the former 2 don't.

It has to be 2.7.x, the "patch" version (the last number) shouldn't matter (unless someone knows more than I do, but that's the rule I've followed).

I wrote a powershell function for this @ItzLevvie @github-account1111 :


function Get-GithubLatestRelease {
    param (
        [parameter(Mandatory)][string]$project, # e.g. paintdotnet/release
        [parameter(Mandatory)][string]$pattern, # regex. e.g. install.x64.zip
        [switch]$prerelease
    )

    # Get all releases and then get the first matching release. Necessary because a project's "latest"
    # release according to Github might be of a different product or component than the one you're
    # looking for. Also, Github's 'latest' release doesn't include prereleases.
    $releases = Invoke-RestMethod -Method Get -Uri "https://api.github.com/repos/$project/releases"
    $downloadUrl = $releases |
                   Where-Object { $_.prerelease -eq $prerelease } |
                   ForEach-Object { $_.assets } |
                   Where-Object { $_.name -match $pattern } |
                   Select-Object -First 1 -ExpandProperty "browser_download_url"

    return $downloadUrl
}

Call it like this

Get-GithubLatestRelease -project "microsoft/winget-cli" -pattern "Microsoft.DesktopAppInstaller.+.msixbundle" -prerelease

Note: the purpose of the -pattern parameter is not just to choose which file to download but also to filter out "releases" that don't have the wanted file (e.g. the most recent release according to github might just be a documentation release).

If I install Store apps this way using winget, will they auto-update?
If not, can I update them through winget?

Or am I stuck with whatever version was out at the time of installation?

Yep, the Store will auto-update packages you sideload if it detects there's an update available.

But I thought the whole premise of this issue is for when there is no Store ๐Ÿ˜…
Or are you saying Microsoft.UI.Xaml.2.7.appx (in conjunction with VCLibs) is the Store (sans GUI) and is what will auto-update things?

Oh, I misunderstood your question. This doesn't install the Store, and you can't install Store apps without the Store being installed (winget will give you a error about not being logged in). Win32 apps can be installed from the Store without it being installed, but they won't be upgraded unless there's also a version of the app in the community repo.

but they won't be upgraded unless there's also a version of the app in the community repo.

That's a bummer..
So then this isn't very useful unless one is okay with using outdated software.

I assumed that since winget can install from the Store (e.g. 9N97ZCKPD60Q and 9PMMSR1CGPWG got installed without issues after Xaml 2.7) it will also be able to update from the Store.
Perhaps that's a planned feature?
I even recall reading that the new Store is just a winget frontend.

they won't be upgraded unless there's also a version of the app in the community repo

Following up, but my Unigram was just upgraded, and that's UWP and from the Store, so I think they will get upgraded!

@denelon why should this be a docs issue?

winget should work on LTSC and Sandbox without us jumping through obscure hoops.

We're working on a solution for making it easier to "bootstrap" WinGet on Windows Server without Microsoft Store access.

We're working on a solution for making it easier to "bootstrap" WinGet on Windows Server without Microsoft Store access.

Why just Windows Server? Will it be possible to bootstrap winget on Windows Desktop as well?

We're working on a solution for making it easier to "bootstrap" WinGet on Windows Server without Microsoft Store access.

winget is an excellent solution to provision Windows sandboxes as well, and if the winget installation wouldn't break every few weeks that would be great too ๐Ÿ˜‡

The solution we're working on should apply to any version of Windows that is recent enough to have our dependencies available.

Invoke-WebRequest -Uri https://www.nuget.org/api/v2/package/Microsoft.UI.Xaml/2.7.3 -OutFile .\microsoft.ui.xaml.2.7.3.zip
Expand-Archive .\microsoft.ui.xaml.2.7.3.zip
Add-AppxPackage .\microsoft.ui.xaml.2.7.3\tools\AppX\x64\Release\Microsoft.UI.Xaml.2.7.appx

Invoke-WebRequest -Uri https://github.com/microsoft/winget-cli/releases/download/v1.3.2691/Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle -OutFile .\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle
Add-AppxPackage .\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle

note: You have to install 2.7, installing latest 2.8.1 of Microsoft.UI.Xaml results in the same error as before when installing winget

@nhooyr Your script seemed to work great. On a new workstation, after the XAML install, my machine seemed to know what to do with a .msixbundle file. The second part seems like you can abbreviate to Add-AppxPackage https://aka.ms/getwinget, but either way it succeeds, except I don't seem to have winget actually installed anywhere. I don't get errors anymore, but winget isn't a command that works using the current Path, and I can't find winget.exe anywhere on my machine.

Here is what is working for me today.

Add-AppxPackage -Path https://aka.ms/Microsoft.VCLibs.x64.14.00.Desktop.appx

Invoke-WebRequest -Uri https://www.nuget.org/api/v2/package/Microsoft.UI.Xaml/2.7.3 -OutFile .\microsoft.ui.xaml.2.7.3.zip
Expand-Archive .\microsoft.ui.xaml.2.7.3.zip
Add-AppxPackage .\microsoft.ui.xaml.2.7.3\tools\AppX\x64\Release\Microsoft.UI.Xaml.2.7.appx

Invoke-WebRequest -Uri https://github.com/microsoft/winget-cli/releases/download/v1.4.10173/Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle -OutFile .\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle
Add-AppxPackage .\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle

The provenance of all these files is direct from Microsoft, except for the command that uses NuGet to extract a file. You're on your own deciding if they are trustworthy.

@AriMSD solution almost worked for me but needed to add the license to avoid #700 on Windows 10 Enterprise LTSC 2019

Invoke-WebRequest -Uri https://github.com/microsoft/winget-cli/releases/download/v1.4.10173/Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle -OutFile .\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle
Invoke-WebRequest -Uri https://github.com/microsoft/winget-cli/releases/download/v1.4.10173/3463fe9ad25e44f28630526aa9ad5648_License1.xml -OutFile .\3463fe9ad25e44f28630526aa9ad5648_License1.xml
Add-AppxProvisionedPackage -Online -PackagePath .\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle -LicensePath .\3463fe9ad25e44f28630526aa9ad5648_License1.xml -Verbose

The Repair-WinGetPackageManager cmdlet in the Microsoft.WinGet.Client PowerShell Module does much of the work to handle dependencies, but Microsoft.UI.Xaml is still not handled in the most optimal way. We're looking at some options here to see if we can improve the situation without needing to download and decompress the dependency.

We've also been looking to update the dependency to Microsoft.UI.Xaml 2.8 from 2.7 in WinGet:

Trenly commented

We're looking at some options here to see if we can improve the situation without needing to download and decompress the dependency.

GitHub releases of the Appx files are now available; see microsoft/winget-pkgs#111841

This worked for me to install the latest version on Win10 Enterprise LTSC 2021 (I was having the same problem):
Edit: Updated for v1.6.3482 release (Dec 18, 2023) and required dependencies [Microsoft isn't directly providing up to date UI XAML dependencies (2.8), but they are including them in the W10 PreInstall kit in the Windows Terminal releases here on Github, so as a workaround, I am pulling it from there instead]

Add-AppxPackage -Path https://aka.ms/Microsoft.VCLibs.x64.14.00.Desktop.appx

IWR -Uri "https://github.com/microsoft/terminal/releases/download/v1.19.10302.0/Microsoft.WindowsTerminal_1.19.10302.0_8wekyb3d8bbwe.msixbundle_Windows10_PreinstallKit.zip" -OutFile ".\Windows10_PreinstallKit.zip"; Expand-Archive -Path ".\Windows10_PreinstallKit.zip" -DestinationPath ".\Windows10_PreinstallKit" -Force; Move-Item -Path ".\Windows10_PreinstallKit\Microsoft.UI.Xaml.2.8_8.2310.30001.0_x64__8wekyb3d8bbwe.appx" -Destination .; Remove-Item -Path ".\Windows10_PreinstallKit.zip" -Force; Remove-Item -Path ".\Windows10_PreinstallKit" -Recurse -Force
Add-AppxPackage -Path ".\Microsoft.UI.Xaml.2.8_8.2310.30001.0_x64__8wekyb3d8bbwe.appx"

IWR -Uri https://github.com/microsoft/winget-cli/releases/download/v1.6.3482/Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle -OutFile .\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle
IWR -Uri https://github.com/microsoft/winget-cli/releases/download/v1.6.3482/24146eb205d040e69ef2d92d7034d97f_License1.xml -OutFile .\24146eb205d040e69ef2d92d7034d97f_License1.xml
Add-AppxProvisionedPackage -Online -PackagePath .\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle -LicensePath .\24146eb205d040e69ef2d92d7034d97f_License1.xml -Verbose

@jedieaston - Should this be closed now that UI.Xaml is distributed at the GitHub?

I have a similar Problem with fresh installed Windows 10 22H2.

using

powershell Add-AppxPackage .\VCLibs.appx -ForceUpdateFromAnyVersion
powershell Add-AppxPackage .\UI.appx -ForceUpdateFromAnyVersion
powershell Add-AppxPackage -Path ".\winget.msixbundle" -InstallAllResources

to install it with a batch file i get following error on the last step:

Add-AppxPackage : Deployment failed with HRESULT: 0x80073CF3, Package failed updates, dependency or conflict
validation.
Windows cannot install package Microsoft.DesktopAppInstaller_1.22.10661.0_x64__8wekyb3d8bbwe because this package
depends on a framework that could not be found. Provide the framework "Microsoft.UI.Xaml.2.8" published by
"CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US", with neutral or x64 processor
architecture and minimum version 8.2310.30001.0, along with this package to install. The frameworks with name
"Microsoft.UI.Xaml.2.8" currently installed are: {Microsoft.UI.Xaml
Windows cannot install package Microsoft.DesktopAppInstaller_1.22.10661.0_x64__8wekyb3d8bbwe because this package
depends on a framework that could not be found. Provide the framework "Microsoft.UI.Xaml.2.8" published by
"CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US", with neutral or x64 processor
architecture and minimum version 8.2310.30001.0, along with this package to install. The frameworks with name
"Microsoft.UI.Xaml.2.8" currently installed are: {Microsoft.UI.Xaml.2.8_8.2306.22001.0_x64__8wekyb3d8bbwe}
NOTE: For additional information, look for [ActivityId] 981811d9-7a58-0002-cf23-1898587ada01 in the Event Log or use
the command line Get-AppPackageLog -ActivityID 981811d9-7a58-0002-cf23-1898587ada01
At line:1 char:1
+ Add-AppxPackage -Path .\winget.msixbundle -InstallAllResources
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : WriteError: (D:\Data\Installscript\winget.msixbundle:String) [Add-AppxPackage], IOExcept
   ion
    + FullyQualifiedErrorId : DeploymentError,Microsoft.Windows.Appx.PackageManager.Commands.AddAppxPackageCommand

Any Ideas?

@LuciDuki - Are you using the 2.8 version of Microsoft.UI.Xaml, and not the 2.7 version? https://github.com/microsoft/microsoft-ui-xaml/releases/tag/v2.8.6

@Trenly - Yes, as it states here:
The frameworks with name "Microsoft.UI.Xaml.2.8" currently installed are: {Microsoft.UI.Xaml.2.8_8.2306.22001.0_x64__8wekyb3d8bbwe}

Already found the issue... installed is version 8.2306.22001.0, but it wants version 8.2310.30001.0.
Only Problem is i cant find this version to download. i always get the 2306 if i download the newest

@Trenly - Yes, as it states here: The frameworks with name "Microsoft.UI.Xaml.2.8" currently installed are: {Microsoft.UI.Xaml.2.8_8.2306.22001.0_x64__8wekyb3d8bbwe}

Already found the issue... installed is version 8.2306.22001.0, but it wants version 8.2310.30001.0. Only Problem is i cant find this version to download. i always get the 2306 if i download the newest

I see, I must have missed that. I believe the telease of Microsoft.UI.Xaml I linked above is what the Repair-WinGetPackageManager cmdlet installs, so that should work. . .

Hello @jedieaston,

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 7 days. It will be closed if no further activity occurs within 7 days of this comment.

Template: msftbot/noRecentActivity

Out of curiousity, why does winget depend on UI libs? Does it use xaml somewhere?

Out of curiousity, why does winget depend on UI libs? Does it use xaml somewhere?


It doesn't. But winget is packaged along DesktopAppInstaller (the UI that shows up when you double-click on an .msix/.msixbundle), which has a dependency on WinUI 2.7.

Originally posted by @florelis in #3380 (comment)

Hello @jedieaston,

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 7 days. It will be closed if no further activity occurs within 7 days of this comment.

Template: msftbot/noRecentActivity