Deploying Windows App SDK Applications
This document provides guidance on how to deploy applications built with the Windows App SDK. The Windows App SDK offers flexible deployment options, allowing you to deliver your applications to users through various channels.
Deployment Options
The Windows App SDK supports two primary deployment models:
1. Framework-Dependent Deployment (Recommended)
In this model, your application relies on a runtime provided by the Windows App SDK. This runtime can be pre-installed on the user's machine or installed alongside your application.
Advantages:
- Smaller application package size: Your app package doesn't need to include the entire Windows App SDK runtime.
- Simplified updates: The Windows App SDK runtime can be updated independently of your application, allowing Microsoft to deliver security patches and performance improvements.
Deployment Methods:
- MSIX containerization: The most common and recommended method. MSIX packages bundle your app and its dependencies, providing a clean installation and update experience.
- Directly from NuGet: When building your application, you reference the Windows App SDK runtime packages via NuGet. The deployment process then ensures the appropriate runtime is available.
2. Self-Contained Deployment
With self-contained deployment, your application package includes the specific version of the Windows App SDK runtime it requires. This ensures your application runs with the exact version it was built against, regardless of what's installed on the user's system.
Advantages:
- Guaranteed compatibility: Eliminates potential versioning conflicts.
- No runtime dependency on the OS: Your application brings its own runtime.
Considerations:
- Larger application package size: The runtime adds to the overall size of your distribution.
- Manual updates: When the Windows App SDK runtime needs updating (e.g., for security patches), users will need to update your application.
Deployment Methods:
Typically deployed as an MSIX package or as an executable with all necessary runtime files bundled.
Packaging Your Application
The Windows App SDK integrates seamlessly with modern packaging technologies, primarily MSIX.
Using MSIX Packaging
MSIX is the recommended packaging format for Windows applications. It provides a robust, reliable, and efficient way to distribute and install applications.
Key Benefits of MSIX:
- Modernizes deployment: Replaces older technologies like App-V and ClickOnce.
- Clean installation and uninstallation: Applications are installed in a contained environment, preventing system clutter.
- Robust update mechanism: Ensures seamless updates and rollbacks.
- Integration with Microsoft Store: Easy distribution through the Microsoft Store.
Steps for MSIX Packaging:
- Configure your project: Ensure your project is set up for MSIX packaging in Visual Studio.
- Create an MSIX package: Use Visual Studio's "Publish" functionality or the
msbuild -p:GenerateAppxPackageOnBuild=true
command. - Include Windows App SDK runtime (if self-contained): If you're using self-contained deployment, ensure the runtime is properly included in your package manifest.
Tip: For framework-dependent deployments, consider using the Dynamic Dependency Lifetime Manager (DDLM) to manage the lifecycle of the Windows App SDK runtime.
Deployment Scenarios
Scenario 1: Desktop Bridge (for existing Win32 apps)
If you have an existing Win32 application, you can modernize it by packaging it as an MSIX using the Desktop Bridge. This allows you to leverage the benefits of MSIX without a full rewrite.
Scenario 2: New UWP-style apps with WinUI 3
Applications built with WinUI 3 and the Windows App SDK can be deployed as framework-dependent or self-contained MSIX packages. This is the standard approach for new Windows applications.
Note: When deploying framework-dependent applications, the target machine must have a compatible version of the Windows App SDK runtime installed. You can ensure this through the Microsoft Store, Windows updates, or by bundling the runtime installer.
Runtime Deployment
For framework-dependent deployments, the Windows App SDK runtime needs to be available on the target machine. Here are common ways to ensure this:
- Pre-installed via Windows Updates: Windows 11 and later versions may have the Windows App SDK runtime pre-installed.
- Microsoft Store: Applications that depend on the Windows App SDK can declare this dependency, and the Store will ensure it's installed.
- Runtime Installer: You can download and distribute the Windows App SDK runtime installer separately. This is useful for internal deployments or scenarios where the Microsoft Store is not an option.
Command-Line Tools
Several command-line tools can assist with the deployment process:
winget
: The Windows Package Manager can be used to install applications and their dependencies.msixmgr
: A tool for managing MSIX packages, including installation, uninstallation, and updates.
Best Practices
- Favor framework-dependent deployment for smaller package sizes and easier runtime updates.
- Use MSIX packaging for a robust and reliable deployment experience.
- Thoroughly test your application across different Windows versions and hardware configurations.
- Document your deployment strategy clearly for your users.
Next Steps
Explore the following resources to further refine your deployment strategy: