Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I install WinGet on Windows Server 2019? [closed]

I'm trying to install WinGet on a Windows Server 2019 (Standard Edition, Version 1809, Build 17763), but I can't get it to work...

When trying the "install directly" link from this blog post I get the following link ms-appinstaller:?source=https://aka.ms/getwinget which my browser doesn't understand because I don't have the App Installer.

So I downloaded the Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.appxbundle from the GitHub releases page mentioned in the same blog post (which should contain both the App Installer and WinGet). Because my system doesn't get .appxbundle files I tried installing it using Powershell:

Add-AppxPackage ".\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.appxbundle"

But it complains that it misses Microsoft.VCLibs.140.00.UWPDesktop:

Add-AppxPackage : Deployment failed with HRESULT: 0x80073CF3, Package failed updates, 
dependency or conflict validation.
Windows cannot install package Microsoft.DesktopAppInstaller_1.11.11451.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.29231.0, along with this package to install. The frameworks with name
"Microsoft.VCLibs.140.00.UWPDesktop" currently installed

Apparently, this is a "C++ Runtime framework packages for Desktop Bridge" that can also be downloaded as an appx; installing it first and then installing the DesktopAppInstaller/WinGet bundle goes without errors:

Add-AppxPackage ".\Microsoft.VCLibs.x64.14.00.Desktop.appx"
Add-AppxPackage ".\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.appxbundle"

However, at this point I seem to have the App Installer (as it now recognises the .appx/.appxbundle files), but not the WinGet client, because when I run it from a command prompt it tells me:

'winget' is not recognized as an internal or external command, operable program or batch file.

How can I get WinGet to work on a Windows Server 2019 machine?

like image 602
Leon Bouquiet Avatar asked Sep 12 '25 15:09

Leon Bouquiet


2 Answers

This worked flawless for me with Windows Server 2022:

https://www.powershellgallery.com/packages/winget-install

PS> Install-Script -Name winget-install
PS> winget-install
like image 112
Christian Avatar answered Sep 15 '25 15:09

Christian


Note added 24-2-2025: DesktopAppInstaller now seems to require VCLibs.140.00.UWPDesktop

You can download the Microsoft Visual C++ UWP Desktop Runtime Package from the official Microsoft Download Center. This package includes a README file which links to the version 14.0.33519.0 of Microsoft.VCLibs.140.00.UWPDesktop

https://www.microsoft.com/en-us/download/details.aspx?id=102159

Or additionally, you can just make use of the updated script below which downloads all this for you.


Referencing one of the comments for winget issue #1861 we can see that all we have to do is download VCLibs, Microsoft.UI.XAML.2.8.6, install it using Add-AppxPackage, download Microsoft.DesktopInstaller and install that as well in order to run winget on a server.

Below is a slightly (not much) modified version of the comment referenced in #1861. It's modified to download the latest version of winget each time it's run alongside its matching dependencies it's published alongside with.

# Disable web request progressbar (Feel free to omit this line)
$ProgressPreference = 'SilentlyContinue' 

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

# Download VCLibs (UWP) and Microsoft.UI.Xaml
Invoke-WebRequest -Uri https://github.com/microsoft/winget-cli/releases/download/v1.9.25180/DesktopAppInstaller_Dependencies.zip -OutFile .\DesktopAppInstaller_Dependencies.zip

# Install VCLibs (UWP)
# Attrib: https://github.com/microsoft/winget-pkgs/blob/master/manifests/m/Microsoft/VCLibs/Desktop/14/14.0.33728.0/Microsoft.VCLibs.Desktop.14.installer.yaml#L15
Expand-Archive .\DesktopAppInstaller_Dependencies.zip
Add-AppxPackage .\DesktopAppInstaller_Dependencies\x64\Microsoft.VCLibs.140.00.UWPDesktop_14.0.33728.0_x64.appx

# Install Microsoft.UI.Xaml
Add-AppxPackage .\DesktopAppInstaller_Dependencies\x64\Microsoft.UI.Xaml.2.8_8.2310.30001.0_x64.appx

# Install the latest release of Microsoft.DesktopAppInstaller from GitHub
Invoke-WebRequest -Uri https://github.com/microsoft/winget-cli/releases/latest/download/Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle -OutFile .\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle
Add-AppxPackage .\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle

If you're looking to use this, just ensure to run it in an empty directory.

like image 41
Joe Avatar answered Sep 15 '25 16:09

Joe