Ability for winget to download a Microsoft Store application for specific Windows build
Description of the new feature / enhancement
I would like to have the possibility to download Microsoft Store application for a specific version. Since by default, winget always downloads the latest version even if incompatible. This disallows to download LPX since one need to download the matching version. Also, for older version of Windows (LTSC) you can stumble upon incompatible application version.
This solves #4995.
The problem
For example, for Microsoft.LanguageExperiencePackfr-FR (9NHMG4BJKMDG): each build has its version with the [build].a.b.c format. The last for 24H2 is 26100.22.41.0 and for Windows 10 21H2/22H2 the last is 19041.79.263.0. However, Winget only download 27754.1.2.0, for the future 25H2. Its manifest confirm it is not compatible with our Windows versions.
<TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.27547.0" MaxVersionTested="10.0.27754.1000" />
Another example with Microsoft.Windows.Photos (9WZDNCRFJBH4) : for the Windows 10 1809 (LTSC), build 17763, the latest compatible is 2023.10030.27002.0. The last version compatible with this build in Winget downloaded version is 2019.19061.18920.0.
Example solution
I would see for an example of solution the use of the "-v" flag in winget. For now, it is not used for Store downloads.
winget download 9NHMG4BJKMDG -v 22000
This would download the Windows 11 22H2 French LPX.
Another possibility is to make a filter with the platform name -v "Windows.Desktop=22000".
Technical implementation details
This would be easily technically implementable without any infrastructure change, only code. Winget calls two API:
- https://displaycatalog.mp.microsoft.com/v7.0/products/${ProductId}?fieldsTemplate=Details&market=FR&languages=fr-fr&catalogIds=4 : to get the app information, WuCategoryId to download it and all versions available and their min build.
- https://storeapps.api.cdp.microsoft.com/api/v2/contents/storeapps/namespaces/default/names/$WuCategoryId/versions/$version/files?action=GenerateDownloadInf : to get the download urls given the WuCategoryId.
The first call is done here MSStoreDownload.cpp and the other here SFSClientImpl.cpp.
Given these APIs winget already have all information at hands. It has all versions but Winget only choose the latest version and ignore the others. It just has to implement a best version for given build algorithm. This algorithm would have to be implemented in these two files.
Thanks, and have a nice day
We've found some similar issues:
- #4995 , similarity score: 84%
If any of the above are duplicates, please consider closing this issue out and adding additional context in the original issue.
Note: You can give me feedback by 👍 or 👎 this comment.
The Microsoft Store doesn't necessarily retain "all" versions for an application. It does have knowledge about a "latest" version for a given MinimumOSVersion. So "logically" if I run download on a Windows 10 device, I might not get the same version of that application as I would if I had run download on a Windows 11 device.
The reason I bring this up is that the "--version" or "-v" argument would be specifying the version of the application I desire as opposed to one suitable for the OS Version I specify.
To make things clearer, we could create another parameter --os-version or something like that. Since in store mode, winget doesn't really use -v (if I remembrer well it only accept one technical value like "default"), I thought about utilizing it. But the goal is to be able to specify the OSVersion to get the latest version available respecting all the MinimumOSVersion.
So "logically" if I run download on a Windows 10 device, I might not get the same version of that application as I would if I had run download on a Windows 11 device.
For now, it only downloads the latest version, compatible or not. For example, on 24H2, winget downloads the Franch LPX for the "25H2" version (screenshot attached, tested live with a Microsoft Windows Client Cloud Solution Architect Engineer).