Skip to content

Centralize NuGet package versions for stable samples - #665

Open
shisan (qiutongMS) wants to merge 6 commits into
mainfrom
integration/main-cpm
Open

Centralize NuGet package versions for stable samples#665
shisan (qiutongMS) wants to merge 6 commits into
mainfrom
integration/main-cpm

Conversation

@qiutongMS

@qiutongMS shisan (qiutongMS) commented Sep 1, 2026

Copy link
Copy Markdown

Why this change

release/experimental already uses Central Package Management (CPM), introduced for native projects in #579 and propagated to the 2.0 line in #590. The broader reconciliation in #660 made the remaining structural difference clear: release/experimental has a centrally managed dependency graph, while main still materializes versions across individual projects and native packages.config files.

This PR brings that proven CPM model to the current stable main tree while preserving its sample set and behavior. Versions already present on main remain the baseline, with Win2D updated to the PackageReference-compatible 1.3.2 version already validated on release/experimental.

CPM provides a few practical benefits for this repository:

  • One auditable source of truth: common package versions are reviewed in Directory.Packages.props instead of being repeated across dozens of projects.
  • Less version drift: managed, packaging, and native projects consume the same declared graph by default; intentional exceptions remain visible through VersionOverride or a scoped package file.
  • Smaller future servicing changes: package updates modify the central graph rather than regenerating many packages.config, .props imports, .targets imports, and missing-package checks.
  • Clear dependency boundaries: the stable 2.4 graph, WindowsML 2.1 graph, and DynamicDependencies 1.5 graph remain explicitly separated rather than being accidentally flattened together.
  • More readable native projects: direct PackageReference items describe what each sample consumes, while NuGet supplies the generated imports.

What changes

The large file count is primarily mechanical. This PR:

  • Adds Samples/Directory.Packages.props as the central version source for the stable 2.4 sample graph.
  • Updates the shared Win2D version from 1.0.3.1 to 1.3.2 because the older package produces duplicate native MSIX payload entries under PackageReference.
  • Keeps the existing WindowsML 2.1 graph isolated in Samples/WindowsML/Directory.Packages.props.
  • Adds DynamicDependenciesSample/Directory.Packages.props because that root-level sample does not inherit from Samples; its existing Windows App SDK 1.5 versions are intentionally preserved.
  • Removes matching inline versions from 47 managed projects and 22 packaging projects. Existing version exceptions use VersionOverride rather than duplicating the common version.
  • Converts 44 native projects from materialized NuGet imports and packages.config to PackageReference, removing 44 generated packages.config files and their missing-import targets.
  • Adds minimal native restore support through Samples/Directory.Build.targets.
  • Updates UpdateVersions.ps1 to update only explicitly selected Directory.Packages.props files instead of recursively rewriting project files.

There are no new samples, sample relocations, source-code changes, or Windows AI feature expansions in this PR.

Version boundaries and intentional exception

Area Decision
Root Samples graph Preserve the versions already present on current main, except for the required Win2D 1.3.2 PackageReference compatibility update.
WindowsML Keep its independently pinned 2.1 package graph; do not inherit the stable 2.4 graph.
DynamicDependencies Keep its current 1.5 graph. #664 updated its toolset but did not update its NuGet packages.
SecureUI native project Keep its native packages.config unchanged. SecureUI is expected to be considered for migration out of stable main in a follow-up reconciliation change, so this PR avoids adding a one-off native-to-WAP restore workaround for it. Its packaging project still consumes centrally managed versions.

This PR deliberately does not add or remove samples, move DynamicDependencies, consolidate packaging projects, change manifests or source behavior, or update unrelated repository metadata. Those broader reconciliation decisions remain outside this focused dependency-management change.

Suggested review order

The functional changes are separated so reviewers do not need to review all 196 files as one undifferentiated change:

  1. 04d81038 — central package files and native restore infrastructure.
  2. 018c65fb — mechanical managed-project version removal.
  3. 58d1db1d — standard native PackageReference conversions.
  4. bea362e1 — independently pinned native projects, including WindowsML and DynamicDependencies.
  5. 56b1e069 — CPM-aware version update tooling.
  6. 1aea53e2 — native WAP restore metadata and Win2D PackageReference compatibility fixes.

For the repetitive project changes, the useful review is to confirm the intended package set and any VersionOverride exceptions. The deleted explicit .props/.targets imports and EnsureNuGetPackageBuildImports blocks are NuGet-generated materialization that PackageReference now supplies.

Validation

Target Release

Windows App SDK 2.4 / stable main dependency-management reconciliation.

Qiutong Shen (from Dev Box) and others added 5 commits September 1, 2026 13:28
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Exclude native project outputs from WAP framework compatibility checks and align the central Win2D version with the PackageReference-compatible release/experimental baseline.

Co-authored-by: Copilot <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

1 participant