Create a packaged app
Overview
A packaged app bundles all of the resources, binaries, and dependencies required to run on Windows. With the Windows App SDK you can create modern desktop apps that are fully packaged and distributed through Microsoft Store or side‑loaded.
Prerequisites
- Windows 10 version 1809 or later
- Visual Studio 2022 (17.8+) with the Desktop development with C++ or .NET desktop development workload installed
- Windows App SDK 1.3+ downloaded and installed
Step‑by‑step guide
-
Create a new project
Open Visual Studio →
File → New → Project
→ search for Windows App SDK and choose Blank App (C#) or Blank App (C++).dotnet new winui3 -n MyPackagedApp
-
Add the app package manifest
In Solution Explorer, right‑click the project →
Add → New Item
→App Package Manifest (Package.appxmanifest)
. Edit the manifest to set the display name, version, and capabilities. -
Configure the app to be packaged
Open the project file (
.csproj
or.vcxproj
) and ensure the following properties are set:<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFramework>net8.0-windows10.0.19041.0</TargetFramework> <OutputType>WinExe</OutputType> <GenerateAppxPackageOnBuild>true</GenerateAppxPackageOnBuild> <PackageCertificateKeyFile>MyCert.pfx</PackageCertificateKeyFile> </PropertyGroup> </Project>
-
Build and package
From the Build menu select
Build Solution
. The generated.msix
package can be found inbin\Debug\AppPackages
. -
Test the package
Double‑click the
.msix
file to install locally, then launch the app from the Start menu.
Common pitfalls
Issue | Resolution |
---|---|
Missing capabilities in manifest | Add required capabilities (e.g., internetClient ) via the manifest designer. |
Package signing error | Create a self‑signed certificate and reference it in the project file. |
App fails to launch after side‑loading | Ensure the target Windows version in TargetFramework matches the OS. |