Skip to content

Split NuGet packages per UI framework (Uwp, WinUI, Uno) - #328

Merged
Sergio0694 merged 8 commits into
mainfrom
sergio0694-split-uno-packages
Dec 5, 2026
Merged

Sergio0694 merged 8 commits into
mainfrom
sergio0694-split-uno-packages

Conversation

@Sergio0694

@Sergio0694 Sergio0694 commented Dec 4, 2026 •

Copy link
Copy Markdown
Member

Each UI framework now has its own set of NuGet packages, so a package never mixes TFMs from different frameworks:

Package ids MultiTargets lib folders
CommunityToolkit.Uwp.* uwp net10.0-windows10.0.26100
CommunityToolkit.WinUI.* wasdk (+ netstandard) net10.0-windows10.0.26100
CommunityToolkit.Uno.* wasm, wpf, linuxgtk, macos, ios, android net10.0, plus the mobile ones with the platform version in the folder name (e.g. net10.0-android36.0, net10.0-ios26.0, net10.0-maccatalyst26.0)

This removes the empty lib/net10.0-windows10.0.18362 placeholder workaround (CommunityToolkit/Windows#388) and the EnableXamlCompilerMismatchedTfmUnoWorkaround property, which only existed because Uno and WinUI assets were mixed in one package.

What changed

  • Package-set logic. PackageIdVariant is now Uwp, WinUI or Uno, derived from the active MultiTargets (enabled and available). EnabledTargetFrameworks.props computes a per-MultiTarget active flag once and derives both TargetFrameworks and the variant from it, so they can't drift. A new EnsureSingleUIFrameworkPackage target fails packing when the active MultiTargets span more than one UI framework.
  • Shared net10.0 TFM. It is now added when one of wasm/wpf/linuxgtk is both enabled and available, like every other MultiTarget. It used to be added when any of them was enabled and any was available, which built an unrequested net10.0 (and could flip the package to Uno or trip the guard) e.g. when wpf was enabled for a component declaring only wasm. The TFM's content is unchanged (IsWasm/IsWpf/IsGtk still follow the available targets).
  • -UIFramework none|uwp|winui|uno on Resolve-MultiTargets.ps1, Build-Toolkit-Components.ps1 and Filter-Supported-Components.ps1 selects the MultiTargets of one framework (plus netstandard for uwp/winui) and implies the WinUI major version. Build-Toolkit-Components.ps1 defaults -MultiTargets to all when -UIFramework is given, and refuses to pack MultiTargets of more than one UI framework. Resolution is now table-driven.
  • CI. A new package job packs a component from the template once per framework (sequentially, in one workspace) and verifies the package id, the exact lib/ TFM folders, no empty placeholders, and the framework-specific dependency (Uwp and WinUI share their lib folder). It also checks that both the script and MSBuild refuse mixed packs. CI config now sets PackageIdPrefix (an empty prefix makes an invalid id).
  • Skipped CI work. Removed the Install Windows SDKs step (about 90-100s per leg) and Install-WindowsSdk.ps1: it installed an old Windows 10 SDK from the uap10.0 era, the TFMs are net10.0-windows10.0.26100.0 with SDK projections from NuGet, and the other jobs/consumers build and test uwp/wasdk without it. setup-vstest only runs where tests run. Fixed .NET Info reporting the wrong SDK and wasm-linux installing the whole workspace as a template.
  • Removed the unused Scripts/PackEachExperiment.ps1 (raw pack with the default enabled set, which now fails by design). Docs, instructions and the validation skill are updated.

Behavior changes to know about

  • Build-Toolkit-Components.ps1 -MultiTargets all -WinUIMajorVersion 3 -NupkgOutput ... now throws (it spans WinUI and Uno). Consumers must pack per framework with -UIFramework. Non-packing flows with -WinUIMajorVersion 3 are unchanged.
  • -WinUIMajorVersion 0 now resolves to netstandard only, and a netstandard-only request with WinUI 3 is refused (like WinUI 2 already was).
  • Uno heads still depend on the CommunityToolkit.WinUI.* 8.3.260402-preview2 packages (no CommunityToolkit.Uno.* package exists on any feed yet). Once a preview with the Uno packages is published, bump the version in ProjectHeads/App.Head.props and set DependencyVariant to Uno in ProjectHeads/App.Head.Uno.props.
  • Apps targeting both Uno and Windows (e.g. a single-project Uno app with a net10.0-windows10.* TFM) must reference CommunityToolkit.Uno.* only for the Uno TFMs and CommunityToolkit.WinUI.* for the Windows one (documented in MultiTarget/ReadMe.md).

Consumer follow-ups (must land with the submodule bump)

  • CI package/sign/release matrices: winui: [2, 3] (Labs [0, 2, 3]) -> ui: [uwp, winui, uno] (Labs also none), pack with -UIFramework ${{ matrix.ui }}, key artifact names on matrix.ui.
  • Run Restore dotnet tools, Remove .NET SDKs newer than global.json and uno-check only for the uno pack leg, with --target android --target ios --target macos; in the build job only for the macos/ios/android legs.
  • Windows Directory.Build.targets: apply the Uno tag when PackageIdVariant == 'Uno' (currently 'WinUI').
  • Delete the now no-op <EnableXamlCompilerMismatchedTfmUnoWorkaround>false</...> lines in components.

Validation

Done in a CI-like layout (template component): the three framework packs (Uwp/WinUI/Uno lib/ and nuspec dependencies), the pack refusals (script and MSBuild), the shared-TFM matrix before/after, and the wasm/uwp/wasdk sample-head builds. Not validated here: macos/ios/android packing (workloads) and the new package CI job on real runners.

Sergio0694 and others added 7 commits December 4, 2026 12:37
Each UI framework now has its own set of packages, so a package never mixes
TFMs from different frameworks: Uwp (uwp), WinUI (wasdk) and Uno (wasm, wpf,
linuxgtk, macos, ios, android).

- EnabledTargetFrameworks.props computes a per-MultiTarget "active" flag (enabled
  and available) once, and derives both TargetFrameworks and the per-framework
  flags from it, so they can't drift apart.
- The shared net10.0 TFM of wasm/wpf/linuxgtk is now added when one of them is
  both enabled and available, like every other MultiTarget. It used to be added
  when any of them was enabled and any was available, which built an unrequested
  net10.0 (and could flip the package to Uno, or trip the pack guard) when e.g.
  wpf was enabled for a component that only declares wasm. The TFM's content
  still covers every available one (IsWasm/IsWpf/IsGtk are unchanged).
- PackageIdVariant is derived from those flags and can now be Uno.
- EnsureSingleUIFrameworkPackage fails packing when the active MultiTargets span
  more than one UI framework.
- Remove the empty lib/net10.0-windows10.0.18362 placeholder workaround and its
  EnableXamlCompilerMismatchedTfmUnoWorkaround property, no longer needed.
- The Uno heads keep depending on the WinUI previews until
  CommunityToolkit.Uno.* packages are published.
- Remove the unused Scripts/PackEachExperiment.ps1, which ran a raw pack of
  every component with the default enabled MultiTargets and now fails by
  design. Use Build-Toolkit-Components.ps1 -NupkgOutput -UIFramework instead.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Resolve-MultiTargets.ps1, Build-Toolkit-Components.ps1 and
Filter-Supported-Components.ps1 take -UIFramework none|uwp|winui|uno, which
selects the MultiTargets of one UI framework (plus netstandard for uwp and
winui) and implies the WinUI major version. Resolve-MultiTargets.ps1 now maps
frameworks, WinUI versions and MultiTargets from a single table, reports the UI
frameworks the resolved MultiTargets span, and resolves WinUI 0 to netstandard
only. A netstandard-only request with WinUI 3 is now refused, like it already
was with WinUI 2.

Build-Toolkit-Components.ps1 defaults -MultiTargets to all when -UIFramework is
given, and refuses to pack MultiTargets of more than one UI framework, so each
package set is packed in its own run.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Add a `package` job that packs a component from the template once per UI
framework (uwp, winui, uno), one after the other in the same workspace, and
verifies the package id, that `lib/` only holds the TFM folder of that
framework with no empty placeholders, and the framework specific dependency
(the Uwp and WinUI packages share their lib folder). It also checks that both
Build-Toolkit-Components.ps1 and MSBuild refuse to pack WinUI and Uno together.
The Uno leg packs the net10.0 targets, as the mobile ones need workloads.

The CI config now sets PackageIdPrefix, as packing fails for ids with an empty
prefix.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Update the repo and MultiTarget instructions, the MultiTarget ReadMe and the
consumer-layout validation skill for the Uwp/WinUI/Uno package split,
-UIFramework and where netstandard ends up.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
- Remove the Windows SDK installer step from the new-experiment and package
  jobs, and delete Install-WindowsSdk.ps1. It installed a Windows 10 SDK from
  the old uap10.0 / MSBuild.Sdk.Extras era (about 90-100s per leg), while the
  TFMs are net10.0-windows10.0.26100.0 with SDK projections from NuGet. The
  windows-2025 image already has the 26100 SDK and the UWP workloads, the
  project-template job has built the wasm and wasdk heads without it since
  6c8f3e3, and the Windows and Labs-Windows CI build and test uwp and wasdk
  without ever installing it.
- Only set up VSTest in the new-experiment legs that run tests (uwp, wasdk).

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
- Run `dotnet --info` from the checkout, where global.json is. It ran from the
  workspace root before global.json was copied there, so it reported the
  newest installed SDK (11.0.100, "global.json file: Not found") instead of
  the 10.0.4xx one the job actually builds with.
- Define PROJECT_DIRECTORY in the wasm-linux job. It was undefined there, so
  `dotnet new --install ./` ran from the workspace root and installed the whole
  repository as a template package (both ctk-component and ct-tooling-heads),
  instead of only tooling/ProjectTemplate like the other jobs do.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
The package job had two large inline scripts, unlike the rest of the workflows,
which invoke scripts. Replace them with:

- Test-Toolkit-Package.ps1: verifies a packed .nupkg (exact id, exact lib
  folders, no empty placeholders, expected dependencies). It also works on any
  local package.
- Test-Toolkit-Pack-Refusal.ps1: checks that packing more than one UI framework
  is refused, by Build-Toolkit-Components.ps1 and by the
  EnsureSingleUIFrameworkPackage MSBuild target.

The workflow now has flat, explicit steps per UI framework (pack, then verify),
still sequential in one workspace on purpose, as the Uwp and WinUI packages
build the same TFM.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
The mobile Uno TFMs are packed in lib folders that carry the platform version
(net10.0-android36.0, net10.0-ios26.0, net10.0-maccatalyst26.0), as seen packing
Labs-Windows in CI.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@Sergio0694
Sergio0694 merged commit e562b88 into main Dec 5, 2026
9 checks passed
@Sergio0694
Sergio0694 deleted the sergio0694-split-uno-packages branch December 5, 2026 00:29
Sergio0694 added a commit to CommunityToolkit/Windows that referenced this pull request Dec 5, 2026
Bump tooling to the commit of CommunityToolkit/Tooling-Windows-Submodule#328, which gives each UI framework its own set of packages.

- Pack once per UI framework (uwp, winui, uno) in the package, sign and release jobs
- Only run uno-check for the mobile Uno build legs and the Uno package leg
- Run the SourceGenerators tests in a single build leg
- Tag the Uno packages as Uno, and not as Windows App SDK/UWP ones
- Update the docs

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Sergio0694 added a commit to CommunityToolkit/Windows that referenced this pull request Dec 5, 2026
* Update tooling to the per-UI-framework packages of Tooling-Windows-Submodule#328

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

* Split NuGet packages per UI framework (Uwp, WinUI, Uno)

Bump tooling to the commit of CommunityToolkit/Tooling-Windows-Submodule#328, which gives each UI framework its own set of packages.

- Pack once per UI framework (uwp, winui, uno) in the package, sign and release jobs
- Only run uno-check for the mobile Uno build legs and the Uno package leg
- Run the SourceGenerators tests in a single build leg
- Tag the Uno packages as Uno, and not as Windows App SDK/UWP ones
- Update the docs

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

* Point Uno users to the Uno packages in the package readmes

Every package ships its component's ReadMe.md, which told Uno.WinUI users to use the WinUI package. The components that only support UWP and Windows App SDK drop the Uno mention.

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

---------

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant