Adding --self-contained to create-debug-identity#335
Draft
Conversation
…/winappcli into nm/activatable-classes
Build Metrics ReportBinary Sizes
Test Results✅ 314 passed, 6 skipped out of 320 tests in 86.2s (+15 tests, +27.7s vs. baseline) CLI Startup Time32ms median (x64, Updated 2026-02-28 02:02:51 UTC · commit |
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a --self-contained option to create-debug-identity and related Node helpers, and expands MSIX/debug-identity plumbing to support self-contained runtime deployment and automatic registration of third-party WinRT components (via .winmd scanning) during packaging.
Changes:
- Add
--self-containedtocreate-debug-identity(C# CLI) andadd-electron-debug-identity(Node CLI wrapper). - Introduce
WinmdServiceto discover WinRT components from NuGet packages and generate manifest registrations for packaged and self-contained scenarios. - Update packaging behaviors/tests/docs/samples (including default MSIX filename now incorporating manifest version).
Reviewed changes
Copilot reviewed 19 out of 19 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| src/winapp-npm/src/msix-utils.ts | Thread selfContained option through native CLI invocations. |
| src/winapp-npm/src/cli.ts | Expose --self-contained for Electron debug identity helper + help text. |
| src/winapp-CLI/WinApp.Cli/Services/WinmdService.cs | New service to parse .winmd metadata and discover WinRT components in NuGet packages. |
| src/winapp-CLI/WinApp.Cli/Services/IWinmdService.cs | New interface/record for WinRT component discovery results. |
| src/winapp-CLI/WinApp.Cli/Services/MsixService.cs | Implement self-contained debug identity flow, WinRT registration generation, and versioned default MSIX output name. |
| src/winapp-CLI/WinApp.Cli/Services/IMsixService.cs | Add selfContained parameter to AddMsixIdentityAsync. |
| src/winapp-CLI/WinApp.Cli/Helpers/HostBuilderExtensions.cs | Register IWinmdService in DI. |
| src/winapp-CLI/WinApp.Cli/Commands/CreateDebugIdentityCommand.cs | Add --self-contained CLI option and pass through to MsixService. |
| src/winapp-CLI/WinApp.Cli.Tests/WinmdServiceTests.cs | Add unit tests for WinMD parsing and component discovery. |
| src/winapp-CLI/WinApp.Cli.Tests/PackageCommandTests.cs | Update output filename expectations; add integration tests for WinRT registration in packaged manifests. |
| src/winapp-CLI/WinApp.Cli.Tests/ManifestCommandTests.cs | Add tests for self-contained debug identity manifest behavior. |
| scripts/msix-assets/install-msix.ps1 | Make MSIX discovery use the script directory instead of current directory. |
| samples/wpf-app/wpf-app.csproj | Add Win2D package reference to exercise third-party WinRT component registration. |
| samples/wpf-app/README.md | Document Win2D sample behavior and requirements. |
| samples/wpf-app/MainWindow.xaml.cs | Validate Win2D activation at runtime and surface status in UI. |
| samples/wpf-app/MainWindow.xaml | Add UI element for Win2D status text. |
| docs/usage.md | Document WinRT component discovery and --self-contained behavior. |
| docs/llm-context.md | Update CLI option listing for create-debug-identity. |
| docs/cli-schema.json | Add --self-contained to CLI schema for create-debug-identity. |
Comments suppressed due to low confidence (1)
scripts/msix-assets/install-msix.ps1:116
- The elevated PowerShell command is built as a single string in
$argumentswith$scriptDir,$PSCommandPath, and user-supplied$PackagePathembedded directly inside single quotes, which enables command injection if any of those values contain a single quote and extra PowerShell tokens. For example, a crafted-PackagePathlikeC:\path\foo'; Start-Process calc; '.msixwould terminate the string and runStart-Process calcin the elevated session. To address this, avoid concatenating a-Commandstring with unescaped values and instead use a safer pattern such as invoking the script via-File/-ArgumentListor rigorously escaping single quotes in all interpolated values before passing them to PowerShell.
$arguments = "-NoProfile -ExecutionPolicy Bypass -Command `"Set-Location '$scriptDir'; & '$PSCommandPath' -Elevated"
if (-not [string]::IsNullOrEmpty($PackagePath)) {
# Convert to absolute path before passing
$PackagePath = Resolve-Path $PackagePath -ErrorAction SilentlyContinue
if ($PackagePath) {
$arguments += " -PackagePath '$PackagePath'"
}
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adding --self-contained flag to create-debug-identity to enable self contained testing during debug identity
Type of Change
Checklist
Screenshots / Demo
Additional Notes
AI Description
The
--self-containedflag has been added to thecreate-debug-identitycommand, enabling developers to bundle Windows App SDK runtime DLLs next to the executable for self-contained deployment. This helps in embedding activation manifests necessary for the local resolution of WinRT classes. Usage example: