Windows "winget is not recognized" / not available on runner in CI
winget was invoked but is not available. winget ships with the App Installer and depends on a user/desktop context that headless CI runners often lack, so it is frequently missing or non-functional.
What this error means
Calling winget fails with CommandNotFoundException, or it is present but errors about no logged-on user. Deterministic for a given image.
winget : The term 'winget' is not recognized as the name of a cmdlet, function,
script file, or operable program.
+ FullyQualifiedErrorId : CommandNotFoundExceptionCommon causes
App Installer is not provisioned for the runner user
winget comes from the App Installer MSIX package, which may not be registered for the non-interactive runner account, so the command does not resolve.
winget needs a desktop/user context it lacks
Even when installed, winget can fail in a headless session that has no interactive user profile.
How to fix it
Use Chocolatey instead
choco is preinstalled on Windows runners and works headless, so prefer it for CI installs.
choco install mytool -y --no-progressRegister the App Installer if winget is required
Register the MSIX so winget resolves for the current user, then retry.
Add-AppxPackage -RegisterByFamilyName -MainPackage `
Microsoft.DesktopAppInstaller_8wekyb3d8bbwe
winget --versionHow to prevent it
- Prefer Chocolatey for headless Windows CI installs; only use winget when you can guarantee the App Installer is provisioned for the runner account.