Packaging Windows App SDK Applications
This document provides detailed guidance on how to package your applications that utilize the Windows App SDK. Effective packaging ensures your app is distributed and installed reliably, managing its dependencies on the Windows App SDK.
Understanding Packaging Approaches
Applications built with the Windows App SDK can be packaged in several ways, each with its own advantages and considerations:
- MSIX: The modern, recommended packaging format for Windows applications. MSIX provides a clean installation and uninstallation experience, automatic updates, and a secure deployment model.
- Framework-dependent deployments: For scenarios where the Windows App SDK is already present on the target machine or managed separately.
- Self-contained deployments: Bundling the necessary Windows App SDK components with your application.
Packaging with MSIX
MSIX is the preferred method for packaging applications that use the Windows App SDK. It simplifies deployment and management significantly.
Key Steps for MSIX Packaging:
- Configure your project: Ensure your project is set up to target the Windows App SDK.
- Add MSIX Packaging Project: In Visual Studio, right-click your solution and select "Add" > "New Project". Search for "MSIX Packaging Project" and select it.
- Reference your app project: In the MSIX Packaging Project, add a reference to your application project.
- Configure the Manifest: Update the
AppxManifest.xml
file to correctly define your application's identity, resources, and dependencies. Pay close attention to the<Dependencies>
section to declare the required Windows App SDK packages. - Build and Sign: Build the MSIX package. You will need to sign your package with a code signing certificate for distribution.
Example MSIX Manifest Snippet:
<Package
xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10/10"
xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10/10"
xmlns:windowsAppSDK="http://schemas.microsoft.com/appx/manifest/windowsAppSDK/Experimental/2021/09"
xmlns:iot="http://schemas.microsoft.com/appx/manifest/iot/windows10/10"
xmlns:desktop="http://schemas.microsoft.com/appx/manifest/desktop/windows10/10"
IgnorableNamespaces="uap mp rescap windowsAppSDK iot desktop">
<Identity Name="YourAppName" Publisher="YourPublisherId" Version="1.0.0.0" ProcessorArchitecture="x64" />
<Properties>
<DisplayName>Your App Name</DisplayName>
<PublisherDisplayName>Your Company</PublisherDisplayName>
<Logo><Logo Path="Assets\StoreLogo.png" /></Logo>
</Properties>
<Resources>
<Resource Language="x-neutral" />
</Resources>
<Applications>
<Application Id="App" Executable="YourApp.exe" EntryPoint="YourApp.App">
<uap:VisualElements DisplayName="Your App Name" Square150x150Logo="Assets\Square150x150Logo.png" Square44x44Logo="Assets\Square44x44Logo.png" Description="A brief description." BackgroundColor="transparent" />
</Application>
</Applications>
<Capabilities>
<rescap:ReadAmbientLightSensor />
<rescap:ReadDeviceCounterService />
<rescap:ReadNearFieldProximitySensor />
<rescap:ReadSimpleOrientationSensor />
<rescap:ReadSystemMediaTransportControls />
<uap:Capability Name="internetClient" />
<uap:Capability Name="privateNetworkClientServer" />
</Capabilities>
<!-- Declare Windows App SDK dependency -->
<Dependencies>
<TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.19041.0" MaxVersionTested="10.0.19041.0" />
<windowsAppSDK:PackageDependency Name="Microsoft.WindowsAppRuntime.1.2" MinVersion="1.2.32324.50000" />
</Dependencies>
</Package>
Framework-Dependent Deployment
In this model, your application is packaged without the Windows App SDK runtime components. It relies on the runtime being pre-installed or managed separately on the user's machine. This results in smaller application packages.
Note: This approach requires careful consideration of the target environment to ensure the correct version of the Windows App SDK is available.
Self-Contained Deployment
With a self-contained deployment, you bundle the necessary Windows App SDK runtime framework packages directly within your application's installation. This makes your application fully independent of any pre-installed SDK versions on the target machine, but it increases the overall size of your application package.
Choosing the Right Approach
The choice between MSIX, framework-dependent, and self-contained deployments depends on your application's distribution strategy, target audience, and management requirements. For most modern applications, MSIX packaging is the recommended and most robust solution.
Refer to the official deployment documentation for more in-depth information on managing and deploying Windows App SDK applications.