Skip to content

Adds winapp run command.#341

Merged
nmetulev merged 56 commits intomainfrom
alzollin/run
Apr 2, 2026
Merged

Adds winapp run command.#341
nmetulev merged 56 commits intomainfrom
alzollin/run

Conversation

@azchohfi
Copy link
Copy Markdown
Collaborator

@azchohfi azchohfi commented Mar 3, 2026

Description

Adds winapp run command, that allows developers to pack a folder and run the application as a packaged application.

Usage Example

winapp run .\bin\Debug\net10.0-windows10.0.26100.0\win-x64 --manifest .\appxmanifest.xml

-->

Related Issue

Fixes #130

Type of Change

  • ✨ New feature

Checklist

Demo

dotnet new wpf
winapp init
dotnet run

Runs the app as a packaged windows app.

AI Description

The winapp run command has been added, which allows developers to pack a folder and run the application as a packaged application. This new command simplifies the process of launching applications in a packaged format. Usage example:

winapp run .\bin\Debug\net10.0-windows10.0.26100.0\win-x64 --manifest .\appxmanifest.xml

@github-actions github-actions Bot added the enhancement New feature or request label Mar 3, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Mar 3, 2026

Build Metrics Report

Binary Sizes

Artifact Baseline Current Delta
CLI (ARM64) 25.92 MB 28.46 MB 📈 +2.54 MB (+9.78%)
CLI (x64) 26.54 MB 28.91 MB 📈 +2.37 MB (+8.91%)
MSIX (ARM64) 11.08 MB 12.05 MB 📈 +995.0 KB (+8.77%)
MSIX (x64) 11.79 MB 12.80 MB 📈 +1.02 MB (+8.62%)
NPM Package 23.01 MB 25.07 MB 📈 +2.05 MB (+8.92%)
NuGet Package N/A 25.15 MB N/A

Test Results

647 passed out of 647 tests in 359.9s (+233 tests, +4.3s vs. baseline)

Test Coverage

30.7% line coverage, 42.4% branch coverage · ⚠️ -11.6% vs. baseline

CLI Startup Time

43ms median (x64, winapp --version) · ✅ +6ms vs. baseline


Updated 2026-04-02 21:50:57 UTC · commit 0accfa2 · workflow run

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces the winapp run command, which enables developers to create a loose-layout MSIX package, register a debug identity, and launch a packaged application. Additionally, it adds a new Microsoft.Windows.SDK.BuildTools.WinApp NuGet package with MSBuild targets that intercept dotnet run to automatically handle the full pack-and-launch pipeline for packaged WinUI apps.

Changes:

  • New winapp run CLI command (RunCommand.cs, AppLauncherService.cs, MsixService.AddLooseLayoutIdentityAsync) that copies app files, replaces manifest tokens, registers the package, and launches via IApplicationActivationManager
  • New Microsoft.Windows.SDK.BuildTools.WinApp NuGet package with MSBuild props/targets that hooks into dotnet run to invoke the CLI automatically
  • Enhancements to WorkspaceSetupService and DotNetService (auto-detects existing WinAppSDK references, adds RuntimeIdentifier, fixes PublishProfile condition, adds WINDOWS_SDK_BUILD_TOOLS_WINAPP_PACKAGE to the init flow)

Reviewed changes

Copilot reviewed 41 out of 43 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
src/winapp-CLI/WinApp.Cli/Commands/RunCommand.cs New command: packs folder, registers identity, launches app via AUMID
src/winapp-CLI/WinApp.Cli/Services/AppLauncherService.cs New service: launches apps via IApplicationActivationManager, computes package family name
src/winapp-CLI/WinApp.Cli/Services/IAppLauncherService.cs New interface for app launching
src/winapp-CLI/WinApp.Cli/Services/MsixService.cs Adds AddLooseLayoutIdentityAsync, renames AddMsixIdentityAsync to AddSparseIdentityAsync, adds RegisterLooseLayoutPackageAsync
src/winapp-CLI/WinApp.Cli/Services/IMsixService.cs Interface update: rename + new AddLooseLayoutIdentityAsync
src/winapp-CLI/WinApp.Cli/Services/DotNetService.cs Adds EnsureRuntimeIdentifierAsync, UpdatePublishProfileAsync, HasPackageReferenceAsync, updated AddOrUpdatePackageReferenceAsync
src/winapp-CLI/WinApp.Cli/Services/IDotNetService.cs Interface additions for new DotNetService methods
src/winapp-CLI/WinApp.Cli/Services/WorkspaceSetupService.cs Auto-skips WinAppSDK prompt if already referenced; always adds build tools NuGet package
src/winapp-CLI/WinApp.Cli/Services/StatusService.cs Suppresses rendering when LogLevel.None (JSON mode)
src/winapp-CLI/WinApp.Cli/Helpers/HostBuilderExtensions.cs Registers IAppLauncherService + (accidentally) duplicates IDotNetService
src/winapp-CLI/WinApp.Cli/Program.cs Adds --json flag parsing with LogLevel.None
src/winapp-CLI/WinApp.Cli/Commands/WinAppRootCommand.cs Adds JsonOption and RunCommand to root
src/winapp-NuGet/build/*.props / *.targets New MSBuild integration for dotnet run interception
src/winapp-NuGet/Microsoft.Windows.SDK.BuildTools.WinApp.csproj New NuGet package project
src/winapp-CLI/WinApp.Cli.Tests/RunCommandTests.cs Tests for new run command
src/winapp-CLI/WinApp.Cli.Tests/DotNetServiceTests.cs Tests for new DotNetService methods
src/winapp-CLI/WinApp.Cli.Tests/WorkspaceSetupServiceTests.cs Updated tests for new package install logic
scripts/build-cli.ps1 / package-nuget.ps1 / setup-winapprun.ps1 Build/packaging scripts for the new NuGet package
docs/usage.md, docs/llm-context.md, docs/dotnet-run-support.md, docs/cli-schema.json Documentation for new run command

Comment thread docs/dotnet-run-support.md Outdated
Comment thread src/winapp-CLI/WinApp.Cli/Commands/RunCommand.cs Outdated
Comment thread docs/usage.md Outdated
Comment thread docs/cli-schema.json Outdated
Comment thread docs/llm-context.md Outdated
Comment thread scripts/package-nuget.ps1 Outdated
Comment thread src/winapp-CLI/WinApp.Cli/Helpers/HostBuilderExtensions.cs Outdated
Comment thread src/winapp-CLI/WinApp.Cli/Commands/RunCommand.cs Outdated
azchohfi and others added 23 commits March 4, 2026 13:21
Resolve merge conflict from deleted docs/llm-context.md (removed in main).
Add 'run' command to setup skill and 'cert info' to signing skill in
generate-llm-docs.ps1 so they appear in auto-generated SKILL.md files.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Add run entry to README.md Commands Overview under App Identity & Debugging
- Add full command reference for winapp run in winapp.agent.md
- Update decision tree to include winapp run as preferred path for
  identity + launch workflow
- Add run/debug usage section to setup skill template
- Update recommended workflow to use winapp run instead of
  create-debug-identity for step 4

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Clearly separate the two commands throughout all documentation:

- winapp run: registers a loose layout package (full folder) with
  Add-AppxPackage, simulating an MSIX install. Preferred for most
  frameworks during iterative development.

- create-debug-identity: registers a sparse package pointing to an
  existing exe via Add-AppxPackage -ExternalLocation. Use when the
  exe is separate from app code (Electron) or testing sparse scenarios.

Updated files:
- winapp.agent.md: decision tree, command refs, rule #5, recipes, glossary
- README.md: differentiated one-line descriptions
- usage.md: added cross-references between both command sections
- setup skill: updated key concepts and workflow
- identity skill: clarified sparse-only focus with when-to-use guidance
- frameworks skill: .NET quick start now uses winapp run
- troubleshoot skill: added winapp run to decision tree and prereqs table
- dotnet guide: winapp run as primary, create-debug-identity as alternative

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Clarify that .NET projects can add the Microsoft.Windows.SDK.BuildTools.WinApp
NuGet package to enable 'dotnet run' with automatic identity registration.
The package invokes 'winapp run' under the hood to create a loose layout
package and launch the app.

Updated files:
- dotnet guide: NuGet package as recommended approach, manual MSBuild target
  as alternative
- frameworks skill: added NuGet package to .NET quick start
- winapp.agent.md: added dotnet run guidance to .NET section
- sample READMEs (dotnet-app, wpf-app): clarified NuGet package usage
- NuGet README: updated to describe winapp run mechanism

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
winapp init already adds Microsoft.Windows.SDK.BuildTools.WinApp to the
.csproj alongside the other NuGet packages, so dotnet run works out of
the box after init. Updated docs to reflect this:

- dotnet guide: restructured step 5 to lead with 'dotnet run' since the
  NuGet package is already present, manual winapp run as alternative
- frameworks skill: noted winapp init adds the package automatically
- winapp.agent.md: updated .NET section accordingly

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Replace the manual ApplyDebugIdentity MSBuild target in dotnet-app and
wpf-app samples with a PackageReference to
Microsoft.Windows.SDK.BuildTools.WinApp. This enables 'dotnet run' to
automatically register a loose layout package and launch with identity.

Changes:
- dotnet-app.csproj: removed ApplyDebugIdentity target, added WinApp
  NuGet package reference
- wpf-app.csproj: same
- samples/nuget.config: added local-winapp feed pointing to
  artifacts/nuget/ so locally-built NuGet packages are resolved
- Updated sample READMEs: prerequisite is now building the CLI locally
  via build-cli.ps1

Both samples restore and build successfully. The PackageMsix targets for
Release builds are preserved unchanged.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
## Description

This PR adds an option to winapp run to launch the application with an
execution alias for scnearios such as console apps or when acces to
stdio is needed.

It also adds a new command (winapp manifest add-alias) to simplify
adding execution alias to a manifest

The nuget is also updated with properties for passing the --with-alias
option


## Related Issue

<!-- Link to any related issues: Fixes #123, Closes #456, Related to
#789 -->

## Type of Change

<!-- Keep the applicable line(s), delete the rest -->

- ✨ New feature

## Checklist
<!-- Delete the ones that do not apply to your changes -->

- [x] New tests added for new functionality (if applicable)
- [x] Tested locally on Windows
- [x] Main [README.md](../README.md) updated (if applicable)
- [x] [docs/usage.md](../docs/usage.md) updated (if CLI commands
changed)
- [x] [Language-specific guides](../docs/guides) updated (if applicable)
- [x] [Sample projects updated](../samples) to reflect changes (if
applicable)
- [x] Agent skill templates updated in `docs/fragments/skills/` (if CLI
commands/workflows changed)

---------

Co-authored-by: Nikola Metulev <711864+nmetulev@users.noreply.github.com>
nmetulev and others added 28 commits March 6, 2026 16:32
…dling

   - Replace full-copy loop with incremental file sync (timestamp+size
     comparison) and stale file cleanup via new IncrementalCopyHelper
   - Remove dead .csproj guard that blocked winapp run for .NET projects
   - Replace cmd /c wrapper in NuGet targets with direct CLI invocation
     using a hidden --caller option for telemetry identification
   - Replace regex-based Executable attribute parsing with
     AppxManifestDocument (XDocument) for correctness
   - Exclude hidden options from CLI schema JSON output
   - Remove unused ComputePackageFullName and MsixIdentityResult fields
   - Add unit tests for IncrementalCopyHelper (11) and PFN computation (8)
@nmetulev nmetulev merged commit 7e83419 into main Apr 2, 2026
11 checks passed
@nmetulev nmetulev deleted the alzollin/run branch April 2, 2026 22:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

WinApp can run/launch a packaged app

3 participants