Skip to content

feat: Enable dotnet run for packaged WinUI apps via WinApp build tools - #23346

Merged
MartinZikmund merged 3 commits into
masterfrom
dev/mazi/winuidotnetrun
Jun 9, 2026
Merged

MartinZikmund merged 3 commits into
masterfrom
dev/mazi/winuidotnetrun

Conversation

@MartinZikmund

@MartinZikmund MartinZikmund commented May 28, 2026 •

Copy link
Copy Markdown
Member

Related to #23345

Summary

  • Adds Microsoft.Windows.SDK.BuildTools.WinApp (0.3.1) to SamplesApp.Windows and makes it an implicit reference for WinAppSDK executables produced by the Uno.Sdk, so dotnet run registers a loose-layout package and launches with package identity — the experience the new dotnet new WinUI templates bring to standalone WinUI apps.
  • The package only overrides ComputeRunArguments and is gated on WindowsPackageType != 'None' + EnableWinAppRunSupport=true, so dotnet build, dotnet publish, and the existing MSIX/AppX packaging flow are unaffected.

Changes

SamplesApp.Windows

  • src/SamplesApp/SamplesApp.Windows/SamplesApp.Windows.csproj — direct PackageReference Include="Microsoft.Windows.SDK.BuildTools.WinApp" Version="0.3.1".

Uno.Sdk implicit reference plumbing

  • src/Uno.Sdk/packages.json — new WinAppSdkBuildToolsWinApp group, default 0.3.1.
  • src/Uno.Sdk/Services/PackageManifest.cs — Group.WinAppSdkBuildToolsWinApp constant.
  • src/Uno.Sdk/Tasks/ImplicitPackagesResolver.cs — accepts and forwards WinAppSdkBuildToolsWinAppVersion.
  • src/Uno.Sdk/targets/Uno.Implicit.Packages.targets — passes the override to the resolver task.
  • src/Uno.Sdk/targets/Uno.Implicit.Packages.ProjectSystem.WinAppSdk.targets — adds the implicit _UnoProjectSystemPackageReference gated on $(_IsExecutable) == 'true' AND '$(UnoDisableWinAppRunSupport)' != 'true'.
  • src/Uno.Sdk/Sdk/Sdk.props.buildschema.json — IntelliSense entries for WinAppSdkBuildToolsWinAppVersion and UnoDisableWinAppRunSupport.

Behavior matrix

Project shape Result
WinAppSDK class library Unchanged (gated by _IsExecutable).
WinAppSDK unpackaged single-project (WindowsPackageType=None) Package referenced, run targets are no-ops, standard dotnet run is used.
WinAppSDK packaged single-project (WindowsPackageType=MSIX) dotnet run performs loose-layout register + identity launch.
SamplesApp.Windows dotnet run launches the packaged SamplesApp with identity.

Knobs

  • WinAppSdkBuildToolsWinAppVersion — override the implicit version.
  • UnoDisableWinAppRunSupport=true — drop the implicit reference entirely.
  • EnableWinAppRunSupport=false — keep the reference but disable the dotnet run interception (e.g., to run unpackaged for debugging).

Test plan

  • dotnet build src/Uno.Sdk/Uno.Sdk.csproj — clean.
  • dotnet format --verify-no-changes on touched C# files — clean.
  • dotnet restore src/SamplesApp/SamplesApp.Windows/SamplesApp.Windows.csproj — Microsoft.Windows.SDK.BuildTools.WinApp/0.3.1 resolved in project.assets.json.
  • JSON files validated (packages.json, Sdk.props.buildschema.json).
  • Run dotnet run against SamplesApp.Windows on a WinAppSDK-enabled Windows host and confirm packaged launch.
  • Run dotnet run against a Uno.Sdk-generated WinAppSDK app (packaged + unpackaged) to confirm the implicit reference flows through correctly.

🤖 Generated with Claude Code

Copilot AI review requested due to automatic review settings May 28, 2026 10:29
@github-actions github-actions Bot added area/automation Categorizes an issue or PR as relevant to project automation area/sdk Categorizes an issue or PR as relevant to the Uno.Sdk labels May 28, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 enables dotnet run support for packaged WinAppSDK apps by adding Microsoft.Windows.SDK.BuildTools.WinApp directly to SamplesApp.Windows and implicitly through Uno.Sdk for executable WinAppSDK projects.

Changes:

  • Adds the WinApp build tools package to SamplesApp.Windows.
  • Adds Uno.Sdk implicit package version plumbing and schema entries.
  • Gates the implicit WinApp run-support reference to WinAppSDK executables with an opt-out property.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/Uno.Sdk/Tasks/ImplicitPackagesResolver.cs Adds version override plumbing for the new implicit package group.
src/Uno.Sdk/targets/Uno.Implicit.Packages.targets Forwards the new version property into the resolver task.
src/Uno.Sdk/targets/Uno.Implicit.Packages.ProjectSystem.WinAppSdk.targets Adds the implicit WinApp run-support package reference for executables.
src/Uno.Sdk/Services/PackageManifest.cs Defines the new manifest group constant.
src/Uno.Sdk/Sdk/Sdk.props.buildschema.json Adds IntelliSense schema entries for the version override and opt-out property.
src/Uno.Sdk/packages.json Adds the default package/version mapping.
src/SamplesApp/SamplesApp.Windows/SamplesApp.Windows.csproj Adds the direct package reference for SamplesApp.Windows.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@unodevops

Copy link
Copy Markdown
Contributor

@MartinZikmund
MartinZikmund force-pushed the dev/mazi/winuidotnetrun branch from 9f2453d to 1589c5d Compare June 5, 2026 16:11
@MartinZikmund MartinZikmund added the ready-to-merge Automatically merge the PR once all '.mergify.yml' policies are met label Jun 5, 2026
@MartinZikmund
MartinZikmund enabled auto-merge June 5, 2026 16:12
@unodevops

Copy link
Copy Markdown
Contributor

MartinZikmund and others added 3 commits June 9, 2026 09:10
Adds Microsoft.Windows.SDK.BuildTools.WinApp so `dotnet run` registers a
loose-layout package and launches the app with package identity, matching
the experience introduced by the new dotnet new templates for WinUI.

- SamplesApp.Windows now opts in via an explicit PackageReference.
- Uno.Sdk pulls the package implicitly for WinAppSDK executables, with
  the version centrally managed in packages.json (group
  WinAppSdkBuildToolsWinApp). Opt out via UnoDisableWinAppRunSupport, or
  set EnableWinAppRunSupport=false to keep the reference but disable the
  dotnet run interception. Override the version with
  WinAppSdkBuildToolsWinAppVersion.

Issue #23345

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@MartinZikmund
MartinZikmund force-pushed the dev/mazi/winuidotnetrun branch from 1589c5d to d2abea8 Compare June 9, 2026 07:11
@unodevops

Copy link
Copy Markdown
Contributor

@MartinZikmund
MartinZikmund merged commit 3c59093 into master Jun 9, 2026
66 of 67 checks passed
@MartinZikmund
MartinZikmund deleted the dev/mazi/winuidotnetrun branch June 9, 2026 09:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/automation Categorizes an issue or PR as relevant to project automation area/sdk Categorizes an issue or PR as relevant to the Uno.Sdk kind/documentation ready-to-merge Automatically merge the PR once all '.mergify.yml' policies are met

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants