Skip to content

Adds winapp run command.#341

Open
azchohfi wants to merge 23 commits intomainfrom
alzollin/run
Open

Adds winapp run command.#341
azchohfi wants to merge 23 commits intomainfrom
alzollin/run

Conversation

@azchohfi
Copy link
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, allowing developers to create a loose layout package from a specified build output folder, register it with Windows, and launch the application. This command improves the development experience by simulating a full MSIX installation. For example, you can use it as follows:

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

Breaking Change: None.

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

github-actions bot commented Mar 3, 2026

Build Metrics Report

Binary Sizes

Artifact Baseline Current Delta
CLI (ARM64) 13.91 MB 14.61 MB 📈 +711.0 KB (+4.99%)
CLI (x64) 13.21 MB 13.85 MB 📈 +661.0 KB (+4.89%)
MSIX (ARM64) 6.05 MB 6.29 MB 📈 +250.6 KB (+4.04%)
MSIX (x64) 6.29 MB 6.55 MB 📈 +273.6 KB (+4.25%)
NPM Package 12.31 MB 12.83 MB 📈 +527.2 KB (+4.18%)

Test Results

433 passed, 6 skipped out of 439 tests in 310.4s (+59 tests, -73.2s vs. baseline)

Test Coverage

56.7% line coverage, 58.2% branch coverage · ⚠️ -6.7% vs. baseline

CLI Startup Time

32ms median (x64, winapp --version) · ✅ no change vs. baseline


Updated 2026-03-06 07:38:37 UTC · commit 2840dd2 · workflow run

Copy link
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

azchohfi and others added 21 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>
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