Table of Contents
Issue
In some cases, after install Winget Windows Package Manager. In the first run, you got the following error message:
PS C:\windows\system32> winget
Program ‘winget.exe’ failed to run: No applicable app licenses foundAt line:1 char:1
+ winget
+ ~~~~~~.
At line:1 char:1
+ winget
+ ~~~~~~
+ CategoryInfo : ResourceUnavailable: (:) [], ApplicationFailedExceptio
n
+ FullyQualifiedErrorId : NativeCommandFailed
Even the App Installer package and all dependencies packages are installed.
PS C:\> $packages = @("Microsoft.VCLibs","DesktopAppInstaller","UI.Xaml")
PS C:\> ForEach ($package in $packages){Get-AppxPackage -Name *$package* | select Name,Version,Status }
Name Version Status
---- ------- ------
Microsoft.VCLibs.140.00.UWPDesktop 14.0.30704.0 Ok
Microsoft.DesktopAppInstaller 1.19.10173.0 Ok
Microsoft.UI.Xaml.2.7 7.2109.13004.0 Ok
Solution
The root of the issue is you used the Add-AppxPackage command to install Windows Package Manager. This command does not support -LicensePath parameter.
1. Visit the winget’s repository on GitHub.
2. On the right side of the page, click on the link to download the latest version of winget.
3. In the download page, scroll down, under the Assets section, let download the xml license file and the msixbundle file.
4. Now, open an elevated Windows PowerShell window (run Windows PowerShell as an administrator).
5. Navigate to the Downloads folder using cd command then run the following command to install Windows Package Manager.
Add-AppxProvisionedPackage -Online `
-PackagePath .\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle `
-LicensePath .\3463fe9ad25e44f28630526aa9ad5648_License1.xml
This time, we use Add-AppxProvisionedPackage command instead of Add-AppxPackage to add the license file to the app.
6. Once done, close the PowerShell window then open a new one. The error should be gone when you run the winget command.
PS C:\Users\admin> winget
Windows Package Manager v1.4.10173
Copyright (c) Microsoft Corporation. All rights reserved.
The winget command line utility enables installing applications and other packages from the command line.
usage: winget [<command>] [<options>]
The following commands are available:
install Installs the given package
show Shows information about a package
source Manage sources of packages
search Find and show basic info of packages
list Display installed packages
upgrade Shows and performs available upgrades
uninstall Uninstalls the given package
hash Helper to hash installer files
validate Validates a manifest file
settings Open settings or set administrator settings
features Shows the status of experimental features
export Exports a list of the installed packages
import Installs all the packages in a file
Alternatively, if you don’t want to do it manually. You can run the below code to download and install automatically.
#Set path to store download files
New-Item -Path C:\Temp -ItemType Directory -Force
$path = "C:\Temp"
Set-Location $path
#Download winget and license file
function getLink($match) {
$uri = "https://api.github.com/repos/microsoft/winget-cli/releases/latest"
$get = Invoke-RestMethod -uri $uri -Method Get -ErrorAction stop
$data = $get[0].assets | Where-Object name -Match $match
return $data.browser_download_url
}
$url = getLink("msixbundle")
$licenseUrl = getLink("License1.xml")
# Install winget
$fileName = "winget.msixbundle"
Invoke-WebRequest -Uri $url -OutFile $fileName
$licenseName = "license1.xml"
Invoke-WebRequest -Uri $licenseUrl -OutFile $licenseName
Add-AppxProvisionedPackage -Online -PackagePath $fileName -LicensePath $licenseName
# Cleanup
Remove-Item $path\* -Recurse -Force