Prerequisites
- Windows 10/11 - Windows Package Manager requires Windows 10 1809 or later
- WinGet Installed - Install from Microsoft Store or GitHub releases
- Development Tools:
- Visual Studio 2019/2022 (for C++/C#)
- .NET 6.0 SDK or later (for C#)
- Windows SDK 10.0.22621.0 or later
Installation
For C# Development
For C++ Development
Create C++/WinRT project
Create a new Windows Console Application with C++/WinRT support in Visual Studio.
Basic Examples
Example 1: List Available Catalogs
Example 2: Search for a Package
Example 3: Install a Package
Configuration Example
Common Patterns
Error Handling
Always check result status codes:Async/Await Pattern
Most operations are asynchronous:Progress Tracking
Monitor long-running operations:Next Steps
PackageManager API
Learn about package operations
Configuration API
Work with configuration sets
Error Handling
Handle errors effectively
Events & Progress
Track operation progress
Troubleshooting
Common Issues
“Class not registered” error- Ensure Windows Package Manager is installed
- Verify your app targets the correct Windows SDK version
- Check that WinGet is available at runtime
- Some operations require administrator privileges
- Declare
runFullTrustcapability in your app manifest
- Ensure catalog is connected before searching
- Check catalog name and package ID spelling
- Verify catalog sources are configured correctly