Repository navigation
winapp package: accept a C++ .vcxproj - #1122
Zach Teutsch (zateutsch) wants to merge 3 commits into
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
Packaging can replace the build-generated runtime dependency with an unrelated configured version, producing an app that fails to launch.
1 open issue
What changed in this PR
Adds direct C++ project packaging to winapp package, reusing the Visual Studio MSBuild path used by winapp run.
Changes:
- Builds
.vcxprojinputs and packages their output with generated or supplied manifests. - Validates unsupported options and improves unsupported-file errors.
- Adds tests and updates help, documentation, and sample instructions.
| File | Description |
|---|---|
| src/winapp-CLI/WinApp.Cli/Commands/PackageCommand.cs | Routes C++ inputs and updates help and errors. |
| src/winapp-CLI/WinApp.Cli/Commands/PackageCommand.CppMode.cs | Implements C++ build-and-package flow. |
| src/winapp-CLI/WinApp.Cli.Tests/PackageCommandProjectModeTests.cs | Tests C++ packaging and validation. |
| src/winapp-CLI/WinApp.Cli.Tests/PackageCommandFakeMsixTests.cs | Updates expected validation text. |
| src/winapp-CLI/WinApp.Cli.Tests/FakeMsixService.cs | Captures executable arguments for assertions. |
| samples/cpp-winui-app/README.md | Adds a packaging example. |
| plugins/winapp/skills/winapp-package/SKILL.md | Documents C++ packaging workflows. |
| docs/usage.md | Documents C++ inputs, options, and limitations. |
| docs/guides/cpp.md | Adds direct project packaging guidance. |
Review effort: Balanced
Build Metrics ReportValidation passed. All required build and validation jobs succeeded. Binary Sizes
.NET Test Results (TRX reports)Other suites are reflected in the overall validation status above. ✅ 10680 passed, 43 skipped out of 10723 tests in 1826.6s (+16 tests, -757.7s vs. baseline) Test Coverage✅ 87.4% line coverage, 81.5% branch coverage · ✅ no change vs. baseline CLI Startup Time69ms median (x64, Try This BuildInstalls the MSIX for your architecture, replacing any previously installed build. Needs the GitHub CLI — the command offers to install it and sign you in if it is missing. & ([scriptblock]::Create((irm https://raw.githubusercontent.com/microsoft/winappCli/main/scripts/winapp-pr.ps1))) 1122Switching between builds often?Put the tool on your PATH once: & ([scriptblock]::Create((irm https://raw.githubusercontent.com/microsoft/winappCli/main/scripts/winapp-pr.ps1))) -AddToPathThen this build is just: winapp-pr 1122Run Updated 2026-10-22 22:04:14 UTC · commit |
ba9f033 to
4a41202
Compare
|
Agent came back with one concern for the --self-contained scenario, but it seems like winapp will only hit this error if the project's vsxproj remains framework-dependent (i.e. Not sure how common that scenario is. Here is its note: Self-contained C++ packaging cannot find the project's restored runtime
Otherwise PR looks good to me. |
4a41202 to
8696de4
Compare
8696de4 to
bde3e74
Compare
|
Agent came back with these concerns: High: Self-contained packaging ignores the runtime used by the C++ buildWhat is wrong: Show me: A framework-dependent C++ project imports its SDK through shared build properties, with no local PowerShell The harness supplied an evaluated SDK directory containing a runtime package. Packaging still reported Why it matters: A project whose build already identifies its runtime cannot produce the requested self-contained package. Smallest fix: Pass the evaluated SDK directory through self-contained runtime setup, not only through framework-dependency rewriting. Location: High: Packaging an explicit C++ project can restore an unrelated C# projectWhat is wrong: The MSIX call omits both Show me: With PowerShell The harness observed Why it matters: The command can contact feeds and change unrelated project files. The unrelated dependency graph can also influence runtime-component entries added to the native package manifest. Smallest fix: Pass |
winapp package .\MyApp.vcxproj now builds the project with Visual Studio's MSBuild (the same build winapp run uses) and packages the build output. Packaged WinUI projects use their generated AppxManifest.xml and appxrecipe; other application projects use an appxmanifest.xml from winapp init or --manifest. --framework and multi-arch bundles are rejected for C++. Unsupported file inputs now say which inputs are supported instead of reporting a misleading sparse-manifest error. Fixes #1115 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: ad679915-8632-4530-8c49-58683247cf14
winapp package App.vcxproj now resolves the runtime dependency from the Windows App SDK the build imported, instead of the version winapp.yaml in the current folder names. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: ad679915-8632-4530-8c49-58683247cf14
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: ad679915-8632-4530-8c49-58683247cf14
bde3e74 to
4a8f814
Compare

What and why
winapp run .\MyApp.vcxprojbuilds and launches a C++ app, butwinapp package .\MyApp.vcxprojfailed with a misleading error about sparse manifests. Nowwinapp packagebuilds a.vcxprojwith Visual Studio's MSBuild (the same buildwinapp runuses) and creates an MSIX from the build output in one step:Releasefor the current architecture by default.-c/-p Configurationand--arch/-p Platformwork the same way as inwinapp run.AppxManifest.xmlits build generates. Other application projects use anappxmanifest.xmlfromwinapp initor--manifest. If none is found, the error says to runwinapp init.--frameworkand multiple--archvalues are rejected with a clear message. To build a multi-architecture bundle, build each architecture and pass the output folders..sln, now says "'App.sln' is not a supported input. Pass a .csproj or .vcxproj project, a build output folder, or a sparse appxmanifest.xml." instead of the sparse-manifest error.Fixes #1115
Before / after
Same sample (
samples\cpp-winui-app), same command.Before (winapp 0.7.1)
After (this branch)
Not tested / risks
appxmanifest.xmlfromwinapp init) was tested with unit tests only, not end to end.Checklist
plugins/winapp/skills/updated if user-facing behavior changedNotes for reviewers
winapp packages the build output itself instead of running MSBuild's own MSIX packaging targets. This keeps signing,
--output,--name, and other options consistent with folder mode and.csprojproject mode. Multi-architecture bundles were left out to keep this change small; one build per architecture pluswinapp package <x64-folder> <arm64-folder>already works.