Skip to content

Commit d041c47

Browse files
committed
Update README with current implementation details
1 parent 2c2596d commit d041c47

1 file changed

Lines changed: 18 additions & 9 deletions

File tree

Samples/MultiHeadedPackage/README.md

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,22 @@ These samples demonstrate how to create **multi-headed packages** — MSIX or sp
2323
A WinUI 3 solution using single-project MSIX packaging with two projects:
2424

2525
- **PrimaryApp** — The main WinUI app that owns the package manifest. Uses `$targetnametoken$` tokens so the build system fills in the correct executable name.
26-
- **SecondaryApp** — A secondary WinUI app referenced by PrimaryApp. Its executable name is hardcoded in the manifest as `SecondaryApp.exe` with `EntryPoint="Windows.FullTrustApplication"`.
26+
- **SecondaryApp** — A console app included in the same MSIX package. Its executable name is hardcoded in the manifest as `SecondaryApp.exe` with `EntryPoint="Windows.FullTrustApplication"`.
2727

2828
After deployment, both apps appear in the Start menu as separate entries.
2929

3030
### Sparse sample (`cs/cs-wpf-sparse/`)
3131

3232
A WPF solution demonstrating multi-headed sparse packages with runtime registration:
3333

34-
- **PrimaryApp** — A WPF app with `WindowsPackageType=Sparse` that includes Register/Unregister/Restart buttons to manage the sparse package at runtime.
35-
- **SecondaryApp** — A minimal WPF app that detects whether it has package identity (which it will once the sparse package is registered).
34+
- **PrimaryApp** — A WPF app with `WindowsPackageType=Sparse` that registers the sparse package at runtime using the `PackageManager` API. After registration, it uses `IApplicationActivationManager` to relaunch with package identity via the app's AUMID (Application User Model ID).
35+
- **SecondaryApp** — A minimal WPF app that detects whether it has package identity. Once the sparse package is registered, the primary app can launch this secondary app with identity using the `SecondaryApp` AUMID entry point.
36+
37+
Key implementation details:
38+
- The manifest uses `uap10:AllowExternalContent="true"` to enable sparse packaging.
39+
- Application entries use `uap10:RuntimeBehavior="win32App"` instead of `EntryPoint` (these are mutually exclusive).
40+
- Restart/launch uses `IApplicationActivationManager.ActivateApplication()` with the package AUMID to ensure the process receives package identity. Launching the exe directly with `Process.Start` would bypass the package activation and the process would not have identity.
41+
- A test certificate (`PrimaryApp_TemporaryKey.pfx`) is included because sparse packages must be signed to be registered.
3642

3743
## Prerequisites
3844

@@ -52,14 +58,17 @@ A WPF solution demonstrating multi-headed sparse packages with runtime registrat
5258

5359
1. Open `cs/cs-wpf-sparse/MultiHeadedSparse.sln` in Visual Studio.
5460
2. Set **PrimaryApp** as the startup project.
55-
3. Press **Ctrl+F5** to run without debugging.
56-
4. Click **Register Package** to register the sparse package.
57-
5. Click **Restart** to relaunch with package identity.
58-
6. Run **SecondaryApp** separately to verify it also detects the package identity.
61+
3. Trust the test certificate: run `certutil -addstore TrustedPeople cs\cs-wpf-sparse\PrimaryApp\PrimaryApp_TemporaryKey.pfx` from an elevated terminal.
62+
4. Press **Ctrl+F5** to build and run without debugging.
63+
5. Click **Register Package** to register the sparse package with the OS.
64+
6. Click **Restart** to relaunch the app with package identity (the status should now show the package full name).
65+
7. Click **Launch Secondary App** to launch the secondary app entry point with package identity.
66+
67+
To clean up, click **Unregister Package** and restart.
5968

6069
## Related links
6170

6271
- [Windows App SDK](https://docs.microsoft.com/windows/apps/windows-app-sdk/)
6372
- [Single-project MSIX packaging](https://docs.microsoft.com/windows/apps/windows-app-sdk/single-project-msix)
64-
- [Sparse packages](https://docs.microsoft.com/windows/apps/desktop/modernize/grant-identity-to-nonpackaged-apps)
65-
- [WindowsAppSDK issue #5586](https://github.com/microsoft/WindowsAppSDK/issues/5586)
73+
- [Grant package identity by packaging with external location](https://docs.microsoft.com/windows/apps/desktop/modernize/grant-identity-to-nonpackaged-apps)
74+
- [IApplicationActivationManager::ActivateApplication](https://learn.microsoft.com/windows/win32/api/shobjidl_core/nf-shobjidl_core-iapplicationactivationmanager-activateapplication)

0 commit comments

Comments
 (0)