### Start Installation Process Source: https://github.com/microsoft/winget-cli/blob/master/doc/specs/ Initiates the installation process by calling the relevant COM API methods. This is the entry point for starting an installation. ```C++ IAsyncAction MainPage::StartInstall( winrt::Windows::UI::Xaml::Controls::Button installButton, ``` -------------------------------- ### Example Installer Download Path Source: https://github.com/microsoft/winget-cli/blob/master/doc/specs/ Illustrates the naming convention for a downloaded package installer. This pattern includes the package identifier, version, scope, architecture, and locale, ensuring uniqueness. ```text > Example installer download path name: %USER_PROFILE%\Downloads\Microsoft.PowerToys_0.78.0\PowerToys (Preview)_0.78.0_User_X64_burn_en-US.exe ``` -------------------------------- ### Interactive PWA Installation Command Source: https://github.com/microsoft/winget-cli/blob/master/doc/specs/ Example of how a user would initiate an interactive installation of a PWA using the winget CLI. The '-i' flag prompts the user for confirmation and launches the app post-installation. ```bash >winget install -i fintimes Found Financial Times [PWAtest.FinTimes] This application is licensed to you by its owner. Microsoft is not responsible for, nor does it grant any licenses to, third-party packages. Starting package install... Successfully installed! Launching app now. This is a necessary step to complete installation. (App launches on Edge) ``` -------------------------------- ### Display Dependencies During Install Source: https://github.com/microsoft/winget-cli/blob/master/doc/specs/ When installing a package, winget will list its declared dependencies. This output shows an example of how dependencies are presented during the installation process. ```bash > winget install Notepad++ Found Notepad++ [Notepad++.Notepad++] This application is licensed to you by its owner. Microsoft is not responsible for, nor does it grant any licenses to, third-party packages. This package requires the following dependencies: - Windows Feature: Hyper-V - Package: Microsoft.WindowsTerminal Downloading https://github.com/notepad-plus-plus/notepad-plus-plus/releases/download/v7.9.5/npp.7.9.5.Installer.x64.exe Successfully verified installer hash Starting package install... ``` -------------------------------- ### WinGet Source Configuration Example Source: https://github.com/microsoft/winget-cli/blob/master/src/AppInstallerCLIE2ETests/README.md This JSON configuration defines the parameters for creating a local winget source. It specifies the working directory, app manifest, local manifests to include, and details for signing installers. ```json { # If running E2E this is must be the StaticFileRoot used for the localhost web server "WorkingDirectory": "c:/dev/temp/TestLocalIndex", # The appx manifest to generate the source.msix file. "AppxManifest": "c:/dev/winget-cli/src/AppInstallerCLIE2ETests/TestData/Package/AppxManifest.xml", # A list of directories or files to copy. If a directory, it copies all the *.yaml files preserving subdirectories. "LocalManifests": [ "c:/dev/winget-cli/src/x86/Release/AppInstallerCLIE2ETests/TestData/Manifests" ], # The signature to use. "Signature": { "CertFile": "cert.pfx", "Password": "1324", # If set it will modify the Package Identity Publisher in the AppxManifest.xml "Publisher": "CN:ThousandSunny" } # Installers that are already present in the machine, by default the installers will be signed using their Signature # property if set or the top level one. "LocalInstallers": [ { "Type": "exe", "Input": "c:/dev/winget-cli/src/x64/Debug/AppInstallerTestExeInstaller\AppInstallerTestExeInstaller.exe", # Name of the installer to be copied and signed if needed. "Name": "AppInstallerTestExeInstaller/AppInstallerTestExeInstaller.exe", # The token in the manifests for this installer. This will be replaces at copy manifests time. "HashToken": "" # Overrides top level one. "Signature": { "CertFile": "cert2.pfx", "Password": "2345", } }, { "Type": "msi", "Input": "c:/dev/winget-cli/src/AppInstallerCLIE2ETests/TestData/AppInstallerTestMsiInstaller.msi", "Name": "AppInstallerTestMsiInstaller/AppInstallerTestMsiInstaller.msi", "HashToken": "" # Don't sign this. "SkipSignature": true }, { "Type": "msix", "Input": "D:/dev/temp/AppInstallerTestMsixInstaller.msix", "Name": "AppInstallerTestMsixInstaller/AppInstallerTestMsixInstaller.msix", "HashToken": "", # Only supported by where type is msix. Package must be signed, either already signed or signed when copied. "SignatureToken": "", } ], # These are installers that are generated on the go. Currently only zip is supported. "DynamicInstallers": [ { # Zip installers are never signed. "Type": "zip", # List of files to zip. Does not preserve subdirectories. "Input": [ "D:/dev/temp/TestLocalIndex/AppInstallerTestExeInstaller/AppInstallerTestExeInstaller.exe", "D:/dev/temp/TestLocalIndex/AppInstallerTestMsiInstaller/AppInstallerTestMsiInstaller.msi", "D:/dev/temp/TestLocalIndex/AppInstallerTestMsixInstaller/AppInstallerTestMsixInstaller.msix" ], "Name": "AppInstallerTestZipInstaller/AppInstallerTestZipInstaller.zip", "HashToken": "" } ], } ``` -------------------------------- ### Install Command Dependency Handling Source: https://github.com/microsoft/winget-cli/blob/master/doc/specs/ Demonstrates the output during the installation of a package with dependencies. It shows the process of building the dependency graph, identifying required packages, and initiating their installation. ```text > winget install Notepad++ Found Notepad++ [Notepad++.Notepad++] This application is licensed to you by its owner. Microsoft is not responsible for, nor does it grant any licenses to, third-party packages. This package requires the following dependencies: - Windows Feature: Hyper-V - Package: Microsoft.WindowsTerminal Building package type dependencies' graph: No errors or cyclic dependencies found. Installing package type dependencies: Found WindowsTerminal [Microsoft.WindowsTerminal] This application is licensed to you by its owner. Microsoft is not responsible for, nor does it grant any licenses to, third-party packages. Downloading (...) Successfully verified installer hash Starting package install... Downloading https://github.com/notepad-plus-plus/notepad-plus-plus/releases/download/v7.9.5/npp.7.9.5.Installer.x64.exe Successfully verified installer hash Starting package install... ``` -------------------------------- ### Install Multiple Applications with a Batch Script Source: https://github.com/microsoft/winget-cli/blob/master/doc/windows/package-manager/winget/index.md Use this batch script to install multiple applications sequentially. Winget launches installers in the specified order and proceeds to the next once the current one returns success or failure. Be aware that if an installer launches another process, it might return to winget prematurely, causing the next installer to launch before the previous one has completed. ```CMD @echo off Echo Install Powertoys and Terminal REM Powertoys winget install Microsoft.Powertoys if %ERRORLEVEL% EQU 0 Echo Powertoys installed successfully. REM Terminal winget install Microsoft.WindowsTerminal if %ERRORLEVEL% EQU 0 Echo Terminal installed successfully. %ERRORLEVEL% ``` -------------------------------- ### Install Package using COM API Source: https://github.com/microsoft/winget-cli/blob/master/doc/specs/ Handles the installation of a package using the COM API. It connects to the Windows package catalog, finds the specified package, and initiates the installation process. UI elements are updated to reflect the installation status. ```cpp winrt::Windows::UI::Xaml::Controls::Button cancelButton, winrt::Windows::UI::Xaml::Controls::ProgressBar progressBar, winrt::Windows::UI::Xaml::Controls::TextBlock statusText) { installButton.IsEnabled(false); cancelButton.IsEnabled(true); co_await winrt::resume_background(); PackageManager packageManager = CreatePackageManager(); PackageCatalogReference catalogRef{ packageManager.GetPredefinedPackageCatalog(PredefinedPackageCatalog::OpenWindowsCatalog) }; ConnectResult connectResult = catalogRef.Connect(); if (connectResult.Status() != ConnectResultStatus::Ok) { co_await winrt::resume_foreground(progressBar.Dispatcher()); statusText.Text(L"Connecting to catalog failed."); co_return; } PackageCatalog catalog = connectResult.PackageCatalog(); FindPackagesResult findPackagesResult{ FindPackageOnBackgroundThread(catalog, m_installAppId) }; winrt::IVectorView matches = findPackagesResult.Matches(); if (matches.Size() > 0) { m_installPackageOperation = InstallPackage(matches.GetAt(0).CatalogPackage()); UpdateUIForInstall(m_installPackageOperation, installButton, cancelButton, progressBar, statusText); } else { co_await winrt::resume_foreground(progressBar.Dispatcher()); statusText.Text(L"Could not find package."); co_return; } } ``` -------------------------------- ### Install Portable App with Winget Source: https://github.com/microsoft/winget-cli/blob/master/doc/specs/ Demonstrates the output when installing a portable application like NuGet. Shows download progress and successful installation. ```text winget install Microsoft.NuGet Found NuGet [Microsoft.NuGet] Version 6.0 This application is licensed to you by its owner. Microsoft is not responsible for, nor does it grant any licenses to, third-party packages. Downloading https://dist.nuget.org/win-x86-commandline/v6.0.0/nuget.exe ██████████████████████████████ 0.1 MB / 0.1 MB Successfully verified installer hash Starting package install... Successfully installed ``` -------------------------------- ### Install Application by Package Identifier Source: https://github.com/microsoft/winget-cli/blob/master/doc/windows/package-manager/winget/install.md Install an application using its unique Package Identifier. This is the most precise way to target an application for installation. ```CMD winget install --id Microsoft.PowerToys ``` -------------------------------- ### Example Test.runsettings Configuration Source: https://github.com/microsoft/winget-cli/blob/master/src/AppInstallerCLIE2ETests/README.md This XML configuration file sets various parameters for running end-to-end tests, including paths to executables, installers, and static file roots. Ensure paths are updated to match your local development environment. ```xml ``` -------------------------------- ### Example Winget Upgrade Command with Dependency Resolution Source: https://github.com/microsoft/winget-cli/blob/master/doc/specs/ Demonstrates the output of the 'winget upgrade' command when package type dependencies are encountered and resolved. This includes identifying required dependencies, building a dependency graph, and installing them. ```bash > winget upgrade Notepad++ Found Notepad++ [Notepad++.Notepad++] This application is licensed to you by its owner. Microsoft is not responsible for, nor does it grant any licenses to, third-party packages. This package requires the following dependencies: - Windows Feature: Hyper-V - Package: Microsoft.WindowsTerminal Building package type dependencies' graph: No errors or cyclic dependencies found. Installing package type dependencies: Found WindowsTerminal [Microsoft.WindowsTerminal] This application is licensed to you by its owner. Microsoft is not responsible for, nor does it grant any licenses to, third-party packages. Downloading (...) Successfully verified installer hash Starting package install... Successfully verified installer hash Starting package install... ``` -------------------------------- ### Install Pure Library Source: https://github.com/microsoft/winget-cli/blob/master/src/PureLib/pure/README.md Install the Pure library using npm. This is the first step to using Pure as a command-line tool. ```shell npm install @ronomon/pure ``` -------------------------------- ### Install Package with Manual Dependency Confirmation Source: https://github.com/microsoft/winget-cli/blob/master/doc/specs/ Use this syntax to be prompted for user confirmation before installing each required dependency, followed by the main package installation. ```bash winget install package ``` -------------------------------- ### Install Package with COM API Source: https://github.com/microsoft/winget-cli/blob/master/doc/specs/ Initiates the package installation process using the PackageManager. This method returns an asynchronous operation that reports progress. ```C++ IAsyncOperationWithProgress MainPage::InstallPackage(CatalogPackage package) { PackageManager packageManager = CreatePackageManager(); InstallOptions installOptions = CreateInstallOptions(); installOptions.PackageInstallScope(PackageInstallScope::Any); return packageManager.InstallPackageAsync(package, installOptions); } ``` -------------------------------- ### List all installed packages Source: https://github.com/microsoft/winget-cli/blob/master/src/PowerShell/Help/Microsoft.WinGet.Client/Get-WinGetPackage.md Use this command to display all packages currently installed on your system. This includes packages installed via WinGet and other methods. ```powershell Get-WinGetPackage ``` -------------------------------- ### Install wingetcreate Utility Source: https://github.com/microsoft/winget-cli/blob/master/doc/windows/package-manager/package/manifest.md Use this command to install the `wingetcreate` utility, which helps in creating package manifests. ```powershell winget install wingetcreate ``` -------------------------------- ### PWA Manifest YAML Example Source: https://github.com/microsoft/winget-cli/blob/master/doc/specs/ Defines the structure for a PWA manifest file, including its ID, version, publisher, moniker, license, installer type, minimum OS version, and installer details. ```yaml Id: FinancialTimesLimited.FinTimes Version: 1.0.0.0 Name: AppInstaller FinTimes Publisher: Financial Times Limited AppMoniker: fintimes License: Test InstallerType: PWA MinOSVersion: 10.0.19041.0 Installers: - Arch: x64 Url: https://app.ft.com InstallerType: PWA ManifestVersion: 0.1.0 ``` -------------------------------- ### Install Package with Automatic Dependency Installation Source: https://github.com/microsoft/winget-cli/blob/master/doc/specs/ Use this syntax to automatically install all required dependencies without user prompts before installing the main package. ```bash winget install package -y ``` -------------------------------- ### Check App Installer Package Info Source: https://github.com/microsoft/winget-cli/blob/master/doc/troubleshooting/README.md Retrieve information about the installed App Installer package to verify its version. ```powershell Get-AppxPackage microsoft.desktopappinstaller ``` -------------------------------- ### Install a package by Name Source: https://github.com/microsoft/winget-cli/blob/master/src/PowerShell/Help/Microsoft.WinGet.Client/Install-WinGetPackage.md Installs a package by providing its name. This is useful when the exact ID is not known but the name is. ```powershell Install-WinGetPackage -Name "PowerToys (Preview)" ``` -------------------------------- ### Install a package using a query Source: https://github.com/microsoft/winget-cli/blob/master/src/PowerShell/Help/Microsoft.WinGet.Client/Install-WinGetPackage.md Installs a package by providing a query string. The Query parameter is positional, so the parameter name can be omitted. ```powershell Install-WinGetPackage Microsoft.PowerShell ``` -------------------------------- ### Install Application by Version and ID Source: https://github.com/microsoft/winget-cli/blob/master/doc/windows/package-manager/winget/install.md Combines the Package Identifier and version to install a specific version of an application. This is useful when multiple versions might be available or to ensure a particular version is installed. ```CMD winget install --id Microsoft.PowerToys --version 0.15.2 ``` -------------------------------- ### Install Specific Version of an Application Source: https://github.com/microsoft/winget-cli/blob/master/doc/windows/package-manager/winget/install.md Use this command to install a specific version of an application. Ensure the version number is accurate. ```CMD winget install powertoys --version 0.15.2 ``` -------------------------------- ### Package Installation Options Source: https://github.com/microsoft/winget-cli/blob/master/doc/specs/ Defines the scopes and modes for installing packages. ```APIDOC ## PackageInstallScope Enum ### Description Required install scope for the package. If the package does not have an installer that supports the specified scope the Install call will fail with InstallResultStatus.NoApplicableInstallers. ### Values - `Any`: An installer with any install scope is valid. - `User`: Only User install scope installers are valid. - `System`: Only System installers will be valid. ``` ```APIDOC ## PackageInstallMode Enum ### Description Options for installing a package. ### Values - `Default`: The default experience for the installer. Installer may show some UI. - `Silent`: Runs the installer in silent mode. This suppresses the installer's UI to the extent possible. - `Interactive`: Runs the installer in interactive mode. ``` -------------------------------- ### Example Minimal Package Manifest Source: https://github.com/microsoft/winget-cli/blob/master/doc/windows/package-manager/package/manifest.md A concrete example of a minimal package manifest for Windows Terminal, demonstrating the required fields and their typical values. ```YAML PackageIdentifier: Microsoft.WindowsTerminal PackageVersion: 1.6.10571.0 PackageLocale: en-US Publisher: Microsoft PackageName: Windows Terminal License: MIT ShortDescription: The new Windows Terminal, a tabbed command line experience for Windows. Installers: - Architecture: x64 InstallerType: msix InstallerUrl: https://github.com/microsoft/terminal/releases/download/v1.6.10571.0/Microsoft.WindowsTerminal_1.6.10571.0_8wekyb3d8bbwe.msixbundle InstallerSha256: 092aa89b1881e058d31b1a8d88f31bb298b5810afbba25c5cb341cfa4904d843 SignatureSha256: e53f48473621390c8243ada6345826af7c713cf1f4bbbf0d030599d1e4c175ee ManifestType: singleton ManifestVersion: 1.4.0 ``` -------------------------------- ### Install-WinGetPackage GivenSet Syntax Source: https://github.com/microsoft/winget-cli/blob/master/src/PowerShell/Help/Microsoft.WinGet.Client/Install-WinGetPackage.md This syntax for installing a WinGet package uses the GivenSet, which requires a PSCatalogPackage object. It allows for specific installation options. ```powershell Install-WinGetPackage [-Mode ] [-Override ] [-Custom ] [-Location ] [-Log ] [-Force] [-Header ] [-AllowHashMismatch] [-Architecture ] [-InstallerType ] [-Locale ] [-Scope ] [-SkipDependencies] [[-PSCatalogPackage] ] [-Version ] [-WhatIf] [-Confirm] [] ``` -------------------------------- ### Get App Installer Package FullName Source: https://github.com/microsoft/winget-cli/blob/master/doc/troubleshooting/README.md Retrieve the full package name of the installed App Installer, which is required for re-registration. ```powershell Get-AppxPackage Microsoft.DesktopAppInstaller | Select Name, PackageFullName ``` -------------------------------- ### Get winget-cli Information Source: https://github.com/microsoft/winget-cli/blob/master/CONTRIBUTING.md Run this command to get detailed information about your winget-cli installation, which can be helpful when reporting issues or seeking support. ```bash winget --info ``` -------------------------------- ### Install application from local manifest Source: https://github.com/microsoft/winget-cli/blob/master/doc/windows/package-manager/winget/install.md Install an application by providing a path to its local manifest file using the `--manifest` option. If the manifest is multi-file, provide the directory containing the files. ```CMD winget install --manifest ``` -------------------------------- ### Install application with exact match and source Source: https://github.com/microsoft/winget-cli/blob/master/doc/windows/package-manager/winget/install.md When multiple sources are configured, specify the `--source` option along with `--id` and `--exact` to uniquely identify the application to install. ```CMD winget install --id Git.Git -e --source winget ``` -------------------------------- ### Get an installed package by its ID Source: https://github.com/microsoft/winget-cli/blob/master/src/PowerShell/Help/Microsoft.WinGet.Client/Get-WinGetPackage.md Retrieve a specific installed package by providing its unique package identifier. This is useful for targeting a single application. ```powershell Get-WinGetPackage -Id "Microsoft.PowerShell" ``` -------------------------------- ### WinGet Download Command Example Source: https://github.com/microsoft/winget-cli/blob/master/doc/specs/ Demonstrates the output of the WinGet download command for a specific package, including license agreement, download progress, and hash validation. ```PowerShell PS C:\> WinGet download --id Microsoft.VisualStudioCode Found Microsoft Visual Studio Code [Microsoft.VisualStudioCode] Version 1.73.1 This application is licensed to you by its owner. Microsoft is not responsible for, nor does it grant any licenses to, third-party packages. Starting package download... \ Successfully verified installer hash Installer downloaded:%USERPROFILE%\Downloads\Microsoft.VisualStudioCode_1.86.1\Microsoft Visual Studio Code_1.86.1_User_X64_inno_en-US.exe ``` -------------------------------- ### Get installed packages by name Source: https://github.com/microsoft/winget-cli/blob/master/src/PowerShell/Help/Microsoft.WinGet.Client/Get-WinGetPackage.md Find installed packages that match a specified name. The comparison is a substring match, allowing for partial name queries. ```powershell Get-WinGetPackage -Name "PowerShell" ``` -------------------------------- ### Get WinGet Version Source: https://github.com/microsoft/winget-cli/blob/master/src/PowerShell/Help/Microsoft.WinGet.Client/Get-WinGetVersion.md Use this command to retrieve the installed version of WinGet. ```powershell Get-WinGetVersion ``` -------------------------------- ### Display Help for All Commands Source: https://github.com/microsoft/winget-cli/blob/master/doc/windows/package-manager/winget/help.md Use the --help argument or the -? shortcut to display help for all available winget commands. ```bash winget --help ``` ```bash winget -? ``` -------------------------------- ### Installer Manifest File Source: https://github.com/microsoft/winget-cli/blob/master/doc/windows/package-manager/package/manifest.md This YAML file contains details about the package installer, including platform, minimum OS version, installer type, install modes, package family name, and specific installer details for different architectures. This file is crucial for the package installation process. ```YAML PackageIdentifier: Microsoft.WindowsTerminal PackageVersion: 1.6.10571.0 Platform: - Windows.Desktop MinimumOSVersion: 10.0.18362.0 InstallerType: msix InstallModes: - silent PackageFamilyName: Microsoft.WindowsTerminal_8wekyb3d8bbwe Installers: - Architecture: x64 InstallerUrl: https://github.com/microsoft/terminal/releases/download/v1.6.10571.0/Microsoft.WindowsTerminal_1.6.10571.0_8wekyb3d8bbwe.msixbundle InstallerSha256: 092aa89b1881e058d31b1a8d88f31bb298b5810afbba25c5cb341cfa4904d843 SignatureSha256: e53f48473621390c8243ada6345826af7c713cf1f4bbbf0d030599d1e4c175ee - Architecture: arm64 InstallerUrl: https://github.com/microsoft/terminal/releases/download/v1.6.10571.0/Microsoft.WindowsTerminal_1.6.10571.0_8wekyb3d8bbwe.msixbundle InstallerSha256: 092aa89b1881e058d31b1a8d88f31bb298b5810afbba25c5cb341cfa4904d843 SignatureSha256: e53f48473621390c8243ada6345826af7c713cf1f4bbbf0d030599d1e4c175ee - Architecture: x86 InstallerUrl: https://github.com/microsoft/terminal/releases/download/v1.6.10571.0/Microsoft.WindowsTerminal_1.6.10571.0_8wekyb3d8bbwe.msixbundle InstallerSha256: 092aa89b1881e058d31b1a8d88f31bb298b5810afbba25c5cb341cfa4904d843 SignatureSha256: e53f48473621390c8243ada6345826af7c713cf1f4bbbf0d030599d1e4c175ee ManifestType: installer ManifestVersion: 1.4.0 ``` -------------------------------- ### Start-WinGetConfiguration Source: https://github.com/microsoft/winget-cli/blob/master/src/PowerShell/Microsoft.WinGet.Configuration/README.md Starts a configuration job for a given configuration set. ```APIDOC ## Start-WinGetConfiguration ### Description Starts a configuration job for a given configuration set. ### Syntax ```powershell Start-WinGetConfiguration -Set [-AcceptConfigurationAgreements] [] ``` ### Parameters #### Path Parameters - **Set** (PSConfigurationSet) - The configuration set to start. - **AcceptConfigurationAgreements** (switch) - Accepts the configuration agreements. ``` -------------------------------- ### Start-WinGetConfiguration Cmdlet Syntax Source: https://github.com/microsoft/winget-cli/blob/master/src/PowerShell/Microsoft.WinGet.Configuration/README.md Use this cmdlet to start a configuration job. Accepts a PSConfigurationSet and an optional flag to accept configuration agreements. ```powershell Start-WinGetConfiguration -Set [-AcceptConfigurationAgreements] [] ``` -------------------------------- ### Configure Installer Type Preferences and Requirements Source: https://github.com/microsoft/winget-cli/blob/master/doc/Settings.md Set preferred and required installer types for package installations. This allows users to prioritize specific installation formats like MSIX or MSI. ```json "installBehavior": { "preferences": { "installerTypes": ["msi", "msix"] }, "requirements": { "installerTypes": ["msix", "msi"] } }, ``` -------------------------------- ### Gated Version Syntax Examples Source: https://github.com/microsoft/winget-cli/blob/master/doc/specs/ Illustrates how the `.*` wildcard in gated versions matches various version formats, and how exact version matching works without the wildcard. ```text Gate version `1.0.*` matches Version `1.0.1` Gate version `1.0.*` matches Version `1.0` Gate version `1.0.*` matches Version `1` Gate version `1.0.*` matches Version `1.0.alpha` Gate version `1.0.*` matches Version `1.0.1.2.3` Gate version `1.0.*` matches Version `1.0.* Gate version `1.0.*` does not match Version `1.1.1` In rare cases where `*` is actually part of a version, only the last `.*` is considered wild card: Gate version `1.*.*` matches Version `1.*.1` Gate version `1.*.*` matches Version `1.* Gate version `1.*.*` does not match Version `1.1.1` If no `.*` in the end is detected, the gate version gates to the specific version: Gate version `1.0.1` matches Version `1.0.1` Gate version `1.0.1` does not match Version `1.1.1` ``` -------------------------------- ### Disable Install Notes Source: https://github.com/microsoft/winget-cli/blob/master/doc/Settings.md Set 'disableInstallNotes' to true to prevent installation notes from being displayed after a successful package installation. Defaults to false. ```json "installBehavior": { "disableInstallNotes": true }, ``` -------------------------------- ### Package Install Progress State Enum Source: https://github.com/microsoft/winget-cli/blob/master/doc/specs/ Defines the possible states of a package installation process. Use this to track the lifecycle of an installation. ```csharp namespace Microsoft.Management.Deployment { [contractversion(1)] apicontract WindowsPackageManagerContract{}; /// State of the install. [contract(Microsoft.Management.Deployment.WindowsPackageManagerContract, 1)] enum PackageInstallProgressState { /// The install is queued but not yet active. Cancellation of the IAsyncOperationWithProgress in this /// state will prevent the package from downloading or installing. Queued, /// The installer is downloading. Cancellation of the IAsyncOperationWithProgress in this state will /// end the download and prevent the package from installing. Downloading, /// The install is in progress. Cancellation of the IAsyncOperationWithProgress in this state will not /// stop the installation or the post install cleanup. Installing, /// The installer has completed and cleanup actions are in progress. Cancellation of the /// IAsyncOperationWithProgress in this state will not stop cleanup or roll back the install. PostInstall, /// The operation has completed. Finished, }; /// Progress object for the install /// DESIGN NOTE: percentage for the install as a whole is purposefully not included as there is no way to /// estimate progress when the installer is running. [contract(Microsoft.Management.Deployment.WindowsPackageManagerContract, 1)] struct InstallProgress { /// State of the install PackageInstallProgressState State; /// DESIGN NOTE: BytesDownloaded may only be available for downloads done by Windows Package Manager itself. /// Number of bytes downloaded if known UInt64 BytesDownloaded; /// DESIGN NOTE: BytesRequired may only be available for downloads done by Windows Package Manager itself. /// Number of bytes required if known UInt64 BytesRequired; /// Download percentage completed Double DownloadProgress; /// Install percentage if known. Double InstallationProgress; }; /// Status of the Install call /// Implementation Note: Errors mapped from AppInstallerErrors.h [contract(Microsoft.Management.Deployment.WindowsPackageManagerContract, 1)] enum InstallResultStatus { Ok, BlockedByPolicy, CatalogError, InternalError, InvalidOptions, DownloadError, InstallError, ManifestError, NoApplicableInstallers, }; /// Result of the install [contract(Microsoft.Management.Deployment.WindowsPackageManagerContract, 1)] runtimeclass InstallResult { /// Used by a caller to correlate the install with a caller's data. String CorrelationData{ get; }; /// Whether a restart is required to complete the install. Boolean RebootRequired{ get; }; /// Batched error code, example APPINSTALLER_CLI_ERROR_SHELLEXEC_INSTALL_FAILED InstallResultStatus Status{ get; }; /// Specific error if known, from downloader or installer itself, example ERROR_INSTALL_PACKAGE_REJECTED HRESULT ExtendedErrorCode{ get; }; } /// IMPLEMENTATION NOTE: SourceOrigin from AppInstallerRepositorySource.h /// Defines the origin of the package catalog details. [contract(Microsoft.Management.Deployment.WindowsPackageManagerContract, 1)] enum PackageCatalogOrigin { /// Predefined means it came as part of the Windows Package Manager package and cannot be removed. Predefined, /// User means it was added by the user and could be removed. User, }; /// IMPLEMENTATION NOTE: SourceTrustLevel from AppInstallerRepositorySource.h /// Defines the trust level of the package catalog. [contract(Microsoft.Management.Deployment.WindowsPackageManagerContract, 1)] enum PackageCatalogTrustLevel { None, Trusted, }; /// IMPLEMENTATION NOTE: SourceDetails from AppInstallerRepositorySource.h /// Interface for retrieving information about an package catalog without acting on it. [contract(Microsoft.Management.Deployment.WindowsPackageManagerContract, 1)] runtimeclass PackageCatalogInfo { /// The package catalog's unique identifier. /// SAMPLE VALUES: For OpenWindowsCatalog "Microsoft.Winget.Source_8wekyb3d8bbwe" /// For contoso sample on msdn "contoso" String Id { get; }; /// The name of the package catalog. /// SAMPLE VALUES: For OpenWindowsCatalog "winget". /// For contoso sample on msdn "contoso" String Name { get; }; /// The type of the package catalog. /// ALLOWED VALUES: "Microsoft.Rest", "Microsoft.PreIndexed.Package" ``` -------------------------------- ### Install-WinGetPackage Parameters Source: https://github.com/microsoft/winget-cli/blob/master/src/PowerShell/Help/Microsoft.WinGet.Client/Install-WinGetPackage.md Details on the parameters for the Install-WinGetPackage command. ```APIDOC ## Install-WinGetPackage ### Description Installs a WinGet package with various customization options. ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters - **-Location** (string) - Optional - Specify the file path where you want the packed to be installed. The installer must be able to support alternate install locations. - **-Log** (string) - Optional - Specify the location for the installer log. The value can be a fully-qualified or relative path and must include the file name. For example: `$env:TEMP\package.log`. - **-MatchOption** (Microsoft.WinGet.Client.PSObjects.PSPackageFieldMatchOption) - Optional - Specify the match option for a WinGet package query. Accepted values: `Equals`, `EqualsCaseInsensitive`, `StartsWithCaseInsensitive`, `ContainsCaseInsensitive`. - **-Mode** (Microsoft.WinGet.Client.PSObjects.PSPackageInstallMode) - Optional - Specify the output mode for the installer. Accepted values: `Default`, `Silent`, `Interactive`. - **-Moniker** (string) - Optional - Specify the moniker of the WinGet package to install. For example, the moniker for the Microsoft.PowerShell package is `pwsh`. - **-Name** (string) - Optional - Specify the name of the package to be installed. - **-Override** (string) - Optional - Use this parameter to override the existing arguments passed to the installer. The parameter takes a single string value. To add multiple arguments, include the arguments in the string. The arguments must be provided in the format expected by the installer. If the string contains spaces, it must be enclosed in quotes. This string overrides the arguments specified in the package manifest. - **-PSCatalogPackage** (Microsoft.WinGet.Client.Engine.PSObjects.PSCatalogPackage) - Optional - Provide PSCatalogPackage object. You can get a PSCatalogPackage object by using the `Find-WinGetPackage` command. - **-Query** (string[]) - Optional - Specify one or more strings to search for. By default, the command searches all configured sources. The command compares the value provided to the following package manifest properties: `PackageIdentifier`, `PackageName`, `Moniker`, `Tags`. The command does a case-insensitive substring comparison of these properties. - **-Scope** (Microsoft.WinGet.Client.PSObjects.PSPackageInstallScope) - Optional - Specify WinGet package installer scope. Accepted values: `Any`, `User`, `System`, `UserOrUnknown`, `SystemOrUnknown`. The installer scope must be available in the WinGet package manifest. - **-SkipDependencies** (SwitchParameter) - Optional - Specifies that the command shouldn't install the WinGet package dependencies. ``` -------------------------------- ### Assert-WinGetPackageManager Cmdlet Source: https://github.com/microsoft/winget-cli/blob/master/src/PowerShell/Help/Microsoft.WinGet.Client/Assert-WinGetPackageManager.md Verifies that WinGet is installed properly. This cmdlet checks if the installed version of WinGet is supported by the installed version of the Microsoft.WinGet.Client module. ```APIDOC ## Assert-WinGetPackageManager ### Description Verifies that WinGet is installed properly. This cmdlet checks if the installed version of WinGet is supported by the installed version of the Microsoft.WinGet.Client module. It does not ensure that the latest version of WinGet is installed. ### Syntax #### IntegrityVersionSet (Default) ```powershell Assert-WinGetPackageManager [-Version ] [] ``` #### IntegrityLatestSet ```powershell Assert-WinGetPackageManager [-Latest] [-IncludePrerelease] [] ``` ### Parameters #### -Version Verifies that a specific version of WinGet is installed correctly. - **Type**: System.String - **Parameter Sets**: IntegrityVersionSet - **Required**: False - **Position**: Named - **Accept pipeline input**: True (ByPropertyName) #### -Latest Verifies that the latest version of WinGet is compatible with the installed version of the Microsoft.WinGet.Client module. - **Type**: System.Management.Automation.SwitchParameter - **Parameter Sets**: IntegrityLatestSet - **Required**: False - **Position**: Named - **Accept pipeline input**: True (ByPropertyName) #### -IncludePreRelease Includes preview versions of WinGet in the verification. - **Type**: System.Management.Automation.SwitchParameter - **Parameter Sets**: IntegrityLatestSet - **Required**: False - **Position**: Named - **Accept pipeline input**: True (ByPropertyName) ### CommonParameters This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -ProgressAction, -Verbose, and -WarningAction. ### Examples #### Example 1: Default usage ```powershell Assert-WinGetPackageManager ``` If the current version of WinGet is installed correctly, the command returns without error. #### Example 2: Check if latest stable version is installed ```powershell Assert-WinGetPackageManager -Latest ``` If the latest version of WinGet is compatible with the installed Microsoft.WinGet.Client module, the command returns without error. #### Example 3: Check if latest preview version is installed ```powershell Assert-WinGetPackageManager -IncludePreRelease ``` If the prerelease version of WinGet is compatible with the installed Microsoft.WinGet.Client module, the command returns without error. #### Example 4: Check if specific version is installed ```powershell Assert-WinGetPackageManager -Version v1.8.1911 ``` If the specified version of WinGet is compatible with the installed Microsoft.WinGet.Client module, the command returns without error. ### Notes When using the `-Latest` or `-Version` parameters, this cmdlet makes GitHub API requests to query release information. Unauthenticated requests are subject to [GitHub API rate limits](https://docs.github.com/en/rest/using-the-rest-api/rate-limits-for-the-rest-api), which can cause failures in CI/CD pipelines. If the `GH_TOKEN` or `GITHUB_TOKEN` environment variable is set, the cmdlet automatically uses it to authenticate requests, which significantly increases the rate limit. `GH_TOKEN` takes precedence over `GITHUB_TOKEN`, matching [GitHub CLI behavior](https://cli.github.com/manual/gh_help_environment). In GitHub Actions, you can make `GITHUB_TOKEN` available to the cmdlet by mapping it as an environment variable in your workflow step (e.g., `env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}`). Use `-Verbose` to see which token source is being used. ``` -------------------------------- ### Handle Installation Completion and UI Update Source: https://github.com/microsoft/winget-cli/blob/master/doc/specs/ Manages the UI state after the installation operation completes, handling success, cancellation, and errors. It updates button states and status text accordingly. ```C++ // This method is called from a background thread. IAsyncAction UpdateUIForInstall( IAsyncOperationWithProgress installPackageOperation, winrt::Windows::UI::Xaml::Controls::Button installButton, winrt::Windows::UI::Xaml::Controls::Button cancelButton, winrt::Windows::UI::Xaml::Controls::ProgressBar progressBar, winrt::Windows::UI::Xaml::Controls::TextBlock statusText) { if (installPackageOperation) { installPackageOperation.Progress([=]( IAsyncOperationWithProgress const& /* sender */, InstallProgress const& progress) { UpdateUIProgress(progressBar, statusText, 50, stateStr).get(); }); winrt::hresult installOperationHr = S_OK; std::wstring errorMessage{ L"Unknown Error" }; InstallResult installResult{ nullptr }; try { installResult = co_await installPackageOperation; } catch (hresult_canceled const&) { errorMessage = L"Cancelled"; OutputDebugString(L"Operation was cancelled"); } catch (...) { // Operation failed // Example: HRESULT_FROM_WIN32(ERROR_DISK_FULL). installOperationHr = winrt::to_hresult(); // Example: "There is not enough space on the disk." errorMessage = winrt::to_message(); OutputDebugString(L"Operation failed"); } // Switch back to ui thread context. co_await winrt::resume_foreground(progressBar.Dispatcher()); cancelButton.IsEnabled(false); installButton.IsEnabled(true); progressBar.IsIndeterminate(false); if (installPackageOperation.Status() == AsyncStatus::Canceled) { installButton.Content(box_value(L"Retry")); statusText.Text(L"Install cancelled."); } if (installPackageOperation.Status() == AsyncStatus::Error || installResult == nullptr) { installButton.Content(box_value(L"Retry")); statusText.Text(errorMessage); } else if (installResult.RebootRequired()) { installButton.Content(box_value(L"Install")); statusText.Text(L"Reboot to finish installation."); } else if (installResult.Status() == InstallResultStatus::Ok) { installButton.Content(box_value(L"Install")); statusText.Text(L"Finished."); } else { installButton.Content(box_value(L"Install")); statusText.Text(L"Install failed."); } } } ``` -------------------------------- ### Create InstallOptions COM Object Source: https://github.com/microsoft/winget-cli/blob/master/doc/specs/ Instantiates the InstallOptions COM object using CoCreateInstance. This object is used to configure installation parameters. ```C++ InstallOptions CreateInstallOptions() { return winrt::create_instance(CLSID_InstallOptions, CLSCTX_ALL); } ``` -------------------------------- ### Appxbundle Installation Failure Error 0x80070490 Source: https://github.com/microsoft/winget-cli/blob/master/doc/troubleshooting/README.md This error indicates an element not found issue when installing appxbundles. Installing KB5005565 and rebooting may resolve this. ```plaintext Install failed: error 0x80070490: Opening the package from location appxbundle_Name.appxbundl failed. 0x80070490 : Element not found. ``` -------------------------------- ### Settings Loading Logic Source: https://github.com/microsoft/winget-cli/blob/master/doc/specs/ Illustrates the conditional logic for loading settings files, prioritizing settings.json, then settings.json.backup, and finally default settings. ```pseudocode if settings exists and valid load settings else if backup exists and valid load settings backup else use default settings ``` -------------------------------- ### Load and Output Configuration Source: https://github.com/microsoft/winget-cli/blob/master/doc/specs/Configuration-COM-API.md Main method to load a configuration set from command-line arguments and initiate the process. It creates a ConfigurationProcessor and opens the specified configuration file. ```C# static void LoadAndOutput(string[] args) { ConfigurationProcessor processor = new ConfigurationProcessor(Helpers.CreateIConfigurationProcessorFactory()); // Open the given configuration file ConfigurationSet configSet = Helpers.OpenConfigurationSet(args[1], processor); ``` -------------------------------- ### Install application with exact match Source: https://github.com/microsoft/winget-cli/blob/master/doc/windows/package-manager/winget/install.md Use the `--id` and `--exact` options to ensure a single application is installed when multiple results are found. This is useful for disambiguating applications with similar names. ```CMD winget install --id Git.Git -e ``` -------------------------------- ### Re-register App Installer Package Source: https://github.com/microsoft/winget-cli/blob/master/doc/troubleshooting/README.md Re-register the App Installer package using its full name to fix potential installation issues. This command requires administrator privileges. ```powershell Add-AppxPackage -register "C:\Program Files\WindowsApps\{PackageFullName}\appxmanifest.xml" -DisableDevelopmentMode ``` -------------------------------- ### WinGet PowerShell Module - Install Package Source: https://github.com/microsoft/winget-cli/blob/master/README.md Installs a specific package using its ID with the Install-WinGetPackage cmdlet. Ensure the Microsoft.WinGet.Client module is installed and the package ID is correct. ```powershell # Install a package Install-WinGetPackage -Id Microsoft.VisualStudioCode ``` -------------------------------- ### Update all packages Source: https://github.com/microsoft/winget-cli/blob/master/src/PowerShell/Help/Microsoft.WinGet.Client/Update-WinGetPackage.md This example shows how to update all packages that have an available upgrade from one of the configured sources. ```powershell Get-WinGetPackage | Where-Object IsUpdateAvailable | Update-WinGetPackage ``` -------------------------------- ### InstallResult Runtime Class Source: https://github.com/microsoft/winget-cli/blob/master/doc/specs/ Contains the result of an installation operation. ```APIDOC ## Runtime Class InstallResult ### Description Provides details about the result of an install operation, including status and error codes. ### Properties - **CorrelationData** (String) - Data used by a caller to correlate the install with their own data. - **RebootRequired** (Boolean) - Indicates whether a restart is required to complete the install. - **Status** (InstallResultStatus) - The batched error code for the operation. - **ExtendedErrorCode** (HRESULT) - A specific error code from the downloader or installer, if known. ``` -------------------------------- ### Enable Direct MSI Installation Source: https://github.com/microsoft/winget-cli/blob/master/doc/Settings.md Enables the direct installation of MSI packages using MSI APIs, bypassing msiexec. This is particularly useful for silent installations requiring elevation. ```json "experimentalFeatures": { "directMSI": true }, ``` -------------------------------- ### Set Default Install Root Directory Source: https://github.com/microsoft/winget-cli/blob/master/doc/Settings.md Define the default root directory for package installations when a package manifest requires an install location. This can be overridden by the --location parameter. ```json "installBehavior": { "defaultInstallRoot": "C:/installRoot" }, ``` -------------------------------- ### WinGet PowerShell Module - Repair Installation Source: https://github.com/microsoft/winget-cli/blob/master/README.md Repairs the WinGet package manager installation using the Repair-WinGetPackageManager cmdlet. This is useful for troubleshooting installation issues. Requires the Microsoft.WinGet.Client module. ```powershell # Repair the WinGet package manager installation Repair-WinGetPackageManager ``` -------------------------------- ### InstallOptions Source: https://github.com/microsoft/winget-cli/blob/master/doc/specs/ Configuration options for the InstallPackageAsync method. ```APIDOC ## InstallOptions ### Description Options to configure the package installation. ### Properties - **PackageVersionId** (PackageVersionId) - Optionally specifies the version of the package to install. - **PreferredInstallLocation** (String) - Specifies an alternate location for installation. - **PackageInstallScope** (PackageInstallScope) - Specifies whether to install for the User or Machine. - **PackageInstallMode** (PackageInstallMode) - Specifies the installation mode (Silent, Interactive, or Default). - **LogOutputPath** (String) - Directs logging to a specified file path. - **AllowHashMismatch** (Boolean) - Continues installation even if the hash does not match. - **BypassIsStoreClientBlockedPolicyCheck** (Boolean) - Allows Store installs when the Store Client is disabled. - **ReplacementInstallerArguments** (String) - Arguments to be passed to the installer (maps to "--override"). - **CorrelationData** (String) - Data for correlating the install, must be JSON encoded. - **AdditionalPackageCatalogArguments** (String) - Arguments to be passed to the source server for REST sources. ``` -------------------------------- ### Register App Installer Package on Windows 10 Source: https://github.com/microsoft/winget-cli/blob/master/doc/troubleshooting/README.md Register the App Installer package using its manifest file on Windows 10 to fix potential installation issues. This command requires administrator privileges. ```powershell $Manifest = (Get-AppxPackage Microsoft.DesktopAppInstaller).InstallLocation + '\appxmanifest.xml'; Add-AppxPackage -DisableDevelopmentMode -Register $Manifest ```