TASK 48 slice 2: the app packs as a Microsoft Store MSIX

The manifest the Store route needs, and a real package built from it.

Packaging/Package.appxmanifest is a full-trust packagedClassicApp: EntryPoint
Windows.FullTrustApplication, uap10:TrustLevel=mediumIL,
uap10:RuntimeBehavior=packagedClassicApp, the rescap runFullTrust capability, and
webcam + microphone DeviceCapabilities. That combination is what lets the packaged
app launch the bundled ffmpeg as a child process and write to the user's profile;
an appContainer package would virtualise the recordings folder instead. x64 only,
en-US only (policy 10.7).

Packaging/Assets/ carries the four tiles the packer requires, generated from the
app's own Assets/llamacasty-logo.jpg by scripts/make-store-logos.py - listing art
and app art cannot drift.

scripts/package-msix.sh publishes Release win-x64 self-contained into
artifacts/msix-stage (a RID-less publish would copy every RID's ONNX native),
stages the manifest as AppxManifest.xml + Assets, and runs the Windows SDK's
makeappx. MSIX_PFX/MSIX_PFX_PASSWORD sign a package for a local test install; the
Store signs submissions. artifacts/ is gitignored.

First real package: artifacts/LlamaCasty.msix, 159 MB, 509 files, 'Package
creation succeeded'.

Schema traps found by packing (makeappx reports one error at a time):
Square310x310Logo and Wide310x150Logo are NOT uap:VisualElements attributes - they
live on uap:DefaultTile.

Guard: StorePackagingTests.The_package_manifest_declares_full_trust_camera_and_
microphone - identity/architecture, the full-trust application element, the three
capabilities, no appContainer VALUE (not the file text: the manifest's own comment
says the word), en-US only, and every referenced logo present.

Full suite 438/438, 0 warnings. Cold-start smoke test after the Velopack removal:
MainWindow loaded, no exceptions.
This commit is contained in:
2026-10-22 09:05:50 -07:00
parent 20cfadca0c
commit daac7689fd
16 changed files with 412 additions and 26 deletions
+41
View File
@@ -2320,3 +2320,44 @@ and change the callers. Don't.
temp directory. Never let the test write to the real `%APPDATA%` log.
4. **Never throw from the rotation**: a failed rotation must degrade to the old behaviour
(the log keeps growing), never take the app down. Same rule as the logger itself.
## 2026-10-22 — PACK A WPF DESKTOP APP AS A MICROSOFT STORE MSIX (RECIPE)
No installer project, no WiX, no `.wapproj`: `dotnet publish` + the Windows SDK's `makeappx`
is enough, and it is what `scripts/package-msix.sh` does.
**The pipeline:**
1. `dotnet publish -c Release -r win-x64 --self-contained -o artifacts/msix-stage` — the RID
matters: an RID-less publish copies **every** RID's native folder (ONNX Runtime, ~17 MB
each) and the package bloats. Self-contained so the package carries its own .NET runtime.
2. The manifest goes at the **package root as `AppxManifest.xml`** (not `Package.appxmanifest`)
with its image folder beside it (`Assets\...` paths are relative to the root).
3. `makeappx pack /d <stage> /p <out>.msix /o` → `Package creation succeeded`. Signing is the
Store's job; `signtool sign /fd SHA256 /f dev.pfx` is only for a local test install.
4. Find the tools with a glob, not a hard-coded SDK version:
`ls -d ".../Windows Kits/10/bin/"*/x64/makeappx.exe | sort -V | tail -1`.
**Full trust, for a real Win32 app (this is the part that decides whether the app still works):**
```xml
<Application Executable="app.exe" EntryPoint="Windows.FullTrustApplication"
uap10:TrustLevel="mediumIL" uap10:RuntimeBehavior="packagedClassicApp">
```
plus `<rescap:Capability Name="runFullTrust" />` and `DeviceCapability` entries for
`webcam`/`microphone`. `packagedClassicApp` is what lets the packaged exe launch a **child
process** (a bundled ffmpeg); an `appContainer` package silently virtualises file writes
instead — recordings "vanish".
**The schema traps — makeappx validates ONE error at a time, so budget 2–3 pack runs:**
- `Square310x310Logo` and `Wide310x150Logo` are **not** attributes of `uap:VisualElements`;
they belong on `<uap:DefaultTile>`, a child of `VisualElements`. (`Square44x44Logo` /
`Square150x150Logo` / `BackgroundColor` *are* on `VisualElements`.)
- Every referenced image must exist at the stated size (`StoreLogo` 50×50, 44×44, 150×150,
310×310, 310×150) — the packer fails on a missing file, and the Store rejects a wrong size.
- Localization: `<Resource Language="en-US"/>` only, unless the listing description is
translated into every declared language.
**Testing the manifest without a Store account:** a source-level xunit guard over the XML —
identity/architecture, the full-trust application attributes, the capabilities, en-US only, and
"every referenced logo exists". ⚠️ Check `appContainer` absence on the **attribute values**,
not `manifest.ToString()` — the file's own comment is *supposed* to say "not appContainer", and
a text-wide ban fails on it (same trap as the `force-ssl`/`Download` guards).