Add multi-headed MSIX package sample apps - experimental#601
Add multi-headed MSIX package sample apps - experimental#601guimafelipe wants to merge 9 commits intorelease/experimentalfrom
Conversation
Add two sample apps demonstrating multiple Application elements in a single package manifest, supporting the multi-headed MSIX packaging feature (WindowsAppSDK #5586): - cs-winui-msix: WinUI 3 primary app + console secondary app in one MSIX package via single-project packaging - cs-wpf-sparse: WPF primary app with register/unregister UI + WPF secondary app in one sparse package Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: ssparach <128866445+ssparach@users.noreply.github.com>
There was a problem hiding this comment.
Consider not checking the certificate into the sample. For sparse packaging, a similar approach to WindowsAIFoundry/cs-wpf-sparse can be followed, where a PowerShell script is used to create a development signing certificate if one does not already exist.
There was a problem hiding this comment.
Their powershell script is not run by the pipeline as they are not using MSIX build tools for that sample.
Our sample is using MSIX build tools (by setting EnableMsixTooling=true and WindowsPackageType=Sparse.
On our code, the targets would error out if the cert is not present as it automatically tries to create and sign the msix package during the build.
If we remove the msix buid tools, we would not be testing our build system at all.
The certificate is just a test one generated with no password and I don't think it would be a security concern. Generating them through powershell script is just another layer of complexity.
Samples/MultiHeadedPackage/cs/cs-wpf-sparse/PrimaryApp/PrimaryApp.csproj
Show resolved
Hide resolved
| </PropertyGroup> | ||
|
|
||
| <ItemGroup> | ||
| <PackageReference Include="Microsoft.WindowsAppSDK" /> |
There was a problem hiding this comment.
Consider adding explicit package versions here as well
There was a problem hiding this comment.
The samples will not build with explicit package versions. They are defined by the repository here https://github.com/microsoft/WindowsAppSDK-Samples/blob/release/experimental/Samples/Directory.Packages.props
lauren-ciha
left a comment
There was a problem hiding this comment.
I'm excited to see these changes go in. Before we do, let's get the samples building in VS and follow up on Sarah's cert concern.
| <Project Sdk="Microsoft.NET.Sdk"> | ||
| <PropertyGroup> | ||
| <OutputType>WinExe</OutputType> | ||
| <TargetFramework>net6.0-windows10.0.19041.0</TargetFramework> |
There was a problem hiding this comment.
I noticed .NET 6 is out of support. Do we want to update it to a higher version (here and in SecondaryApp.csproj?
There was a problem hiding this comment.
This is consistent with the other samples. If we update the dotnet version for this, we should update all of them to the minimum supported version.
| </uap:VisualElements> | ||
| </Application> | ||
|
|
||
| <!-- Secondary: hardcoded exe name, no tokens --> |
There was a problem hiding this comment.
Is the exe name hardcoded here to prevent collisions or some other reason?
There was a problem hiding this comment.
It is hardcoded because the build system only automatically updates the "header project" values. For the other projects, we need to hardcode the names. This is similar to WAP experience. It is in my backlog to add a feature to fill in the Application fields automatically from the referenced projects.
| 2. Set **PrimaryApp** as the startup project. | ||
| 3. Press **F5** to build, deploy, and launch the primary app. |
There was a problem hiding this comment.
F5 builds aren't currently supported. When I build and run in VS (2026), I get this error:
{PathToSamplesRepo}\Samples\MultiHeadedPackage\cs\cs-winui-msix\PrimaryApp\Properties\launchSettings.json was not found. To debug a packaged single-project MSIX solution, a profile with command name MsixPackage in launchSettings.json is required. For more information, visit https://aka.ms/winappsdk.singleproj.
This error is in {pathToDotNuget}\.nuget\packages\microsoft.windowsappsdk.base\1.8.250831001\buildTransitive\Microsoft.WindowsAppSDK.SingleProject.targets, so we'll need to update the Single-project MSIX VSIX to support this as well.
Summary
Samples/MultiHeadedPackage/demonstrating multiple<Application>elements in a single package manifestThese samples support the multi-headed MSIX packaging feature added in WindowsAppSDK (microsoft/WindowsAppSDK#5586).
Description
Multi-headed packages contain multiple
<Application>entries in a singlePackage.appxmanifest. Each application gets its own Start menu tile and can be launched independently, while sharing the same package identity and installation lifecycle.The MSIX sample uses single-project MSIX packaging. The primary WinUI app owns the manifest and uses
$targetnametoken$tokens. The secondary console app is included via<ProjectReference>with its executable hardcoded in the manifest asSecondaryApp.exewithEntryPoint="Windows.FullTrustApplication". After deployment, both apps appear as separate Start menu entries.The sparse sample demonstrates the same multi-headed pattern with runtime-registered sparse packages. The primary WPF app provides Register/Unregister/Restart buttons using
PackageManager.AddPackageByUriAsync. The secondary WPF app usesGetCurrentPackageFullNameto detect whether it has package identity, which it will once the sparse package is registered.