Repository navigation
feat: Enable dotnet run for packaged WinUI apps via WinApp build tools - #23346
Conversation
There was a problem hiding this comment.
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.
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-23346/wasm-skia-net9/index.html |
9f2453d to
1589c5d
Compare
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-23346/wasm-skia-net9/index.html |
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]>
1589c5d to
d2abea8
Compare
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-23346/wasm-skia-net9/index.html |
Related to #23345
Summary
Microsoft.Windows.SDK.BuildTools.WinApp(0.3.1) toSamplesApp.Windowsand makes it an implicit reference for WinAppSDK executables produced by the Uno.Sdk, sodotnet runregisters a loose-layout package and launches with package identity — the experience the newdotnet newWinUI templates bring to standalone WinUI apps.ComputeRunArgumentsand is gated onWindowsPackageType != 'None'+EnableWinAppRunSupport=true, sodotnet build,dotnet publish, and the existing MSIX/AppX packaging flow are unaffected.Changes
SamplesApp.Windows
src/SamplesApp/SamplesApp.Windows/SamplesApp.Windows.csproj— directPackageReference Include="Microsoft.Windows.SDK.BuildTools.WinApp" Version="0.3.1".Uno.Sdk implicit reference plumbing
src/Uno.Sdk/packages.json— newWinAppSdkBuildToolsWinAppgroup, default0.3.1.src/Uno.Sdk/Services/PackageManifest.cs—Group.WinAppSdkBuildToolsWinAppconstant.src/Uno.Sdk/Tasks/ImplicitPackagesResolver.cs— accepts and forwardsWinAppSdkBuildToolsWinAppVersion.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_UnoProjectSystemPackageReferencegated on$(_IsExecutable) == 'true' AND '$(UnoDisableWinAppRunSupport)' != 'true'.src/Uno.Sdk/Sdk/Sdk.props.buildschema.json— IntelliSense entries forWinAppSdkBuildToolsWinAppVersionandUnoDisableWinAppRunSupport.Behavior matrix
_IsExecutable).WindowsPackageType=None)dotnet runis used.WindowsPackageType=MSIX)dotnet runperforms loose-layout register + identity launch.SamplesApp.Windowsdotnet runlaunches 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 thedotnet runinterception (e.g., to run unpackaged for debugging).Test plan
dotnet build src/Uno.Sdk/Uno.Sdk.csproj— clean.dotnet format --verify-no-changeson touched C# files — clean.dotnet restore src/SamplesApp/SamplesApp.Windows/SamplesApp.Windows.csproj—Microsoft.Windows.SDK.BuildTools.WinApp/0.3.1resolved inproject.assets.json.packages.json,Sdk.props.buildschema.json).dotnet runagainstSamplesApp.Windowson a WinAppSDK-enabled Windows host and confirm packaged launch.dotnet runagainst a Uno.Sdk-generated WinAppSDK app (packaged + unpackaged) to confirm the implicit reference flows through correctly.🤖 Generated with Claude Code