Skip to content

Migrate to Centralized NuGet Package Management (CPM)#172

Merged
Tyrrrz merged 4 commits intomasterfrom
copilot/migrate-to-centralized-package-management
Feb 26, 2026
Merged

Migrate to Centralized NuGet Package Management (CPM)#172
Tyrrrz merged 4 commits intomasterfrom
copilot/migrate-to-centralized-package-management

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Feb 26, 2026

  • Create Directory.Packages.props at repo root with all 22 unique packages sorted alphabetically
  • Update all 7 .csproj files – remove Version from all <PackageReference> elements
  • Add Directory.Packages.props to the Misc solution folder in CliFx.sln
  • Verify build succeeds
Original prompt

Migrate to Centralized NuGet Package Management (CPM)

Migrate the repository from per-project Version attributes on <PackageReference> to NuGet's Centralized Package Management (CPM).

What to do

  1. Create a Directory.Packages.props file at the root of the repository with <ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally> and a <PackageVersion> entry for every unique package used across all .csproj files. Use the version already present in the .csproj files.

  2. Update all .csproj files to remove the Version="..." attribute from every <PackageReference> element (CPM now manages the version centrally). Keep all other attributes (e.g. PrivateAssets, Condition, ExcludeAssets, etc.) intact.

  3. Do not change any TargetFramework(s), project structure, or anything unrelated to package versioning.

Reference

See how it was done in the sibling repo Tyrrrz/YoutubeExplode PR #940: Tyrrrz/YoutubeExplode#940

Notes

  • If a package appears with different versions in different projects, use the highest version and make a note in the PR description.
  • <PackageVersion> entries in Directory.Packages.props should be sorted alphabetically.
  • Make sure the file includes a valid MSBuild props file <Project> root element.
  • Preserve all Condition attributes on <PackageReference> elements.
  • Use VersionOverride for any Roslyn analyzer packages that need a specific version per-project.

This pull request was created from Copilot chat.


🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

Co-authored-by: Tyrrrz <1935960+Tyrrrz@users.noreply.github.com>
Copilot AI changed the title [WIP] Migrate to Centralized NuGet Package Management Migrate to Centralized NuGet Package Management (CPM) Feb 26, 2026
@Tyrrrz Tyrrrz added the enhancement New feature or request label Feb 26, 2026
@Tyrrrz Tyrrrz marked this pull request as ready for review February 26, 2026 19:01
Copilot AI review requested due to automatic review settings February 26, 2026 19:01
@Tyrrrz
Copy link
Copy Markdown
Owner

Tyrrrz commented Feb 26, 2026

@copilot add the created Directory.Packages.props file to the sln file

Copy link
Copy Markdown
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 migrates the solution to NuGet Central Package Management (CPM) by centralizing all package versions into a root Directory.Packages.props, removing per-project Version="..." attributes while preserving existing reference metadata (e.g., PrivateAssets, Condition).

Changes:

  • Added Directory.Packages.props with ManagePackageVersionsCentrally enabled and centralized <PackageVersion> entries.
  • Updated all .csproj files to remove per-PackageReference Version attributes in favor of CPM.
  • Preserved the Roslyn analyzer lower-version constraint via VersionOverride in CliFx.Analyzers.csproj.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
Directory.Packages.props Introduces CPM and centralizes all NuGet package versions.
CliFx/CliFx.csproj Removes per-reference versions; keeps conditional reference attributes intact.
CliFx.Tests/CliFx.Tests.csproj Removes per-reference versions for test dependencies.
CliFx.Tests.Dummy/CliFx.Tests.Dummy.csproj Removes per-reference version for build-time tooling dependency.
CliFx.Demo/CliFx.Demo.csproj Removes per-reference versions for demo dependencies.
CliFx.Benchmarks/CliFx.Benchmarks.csproj Removes per-reference versions for benchmark dependencies.
CliFx.Analyzers/CliFx.Analyzers.csproj Uses VersionOverride for Roslyn packages to preserve lowest-compiler targeting.
CliFx.Analyzers.Tests/CliFx.Analyzers.Tests.csproj Removes per-reference versions for analyzer test dependencies.

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

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Tyrrrz <1935960+Tyrrrz@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Feb 26, 2026

@copilot add the created Directory.Packages.props file to the sln file

Done in 7d9d8d8Directory.Packages.props is now listed under the Misc solution folder alongside Directory.Build.props.

@Tyrrrz Tyrrrz merged commit ae65ac7 into master Feb 26, 2026
@Tyrrrz Tyrrrz deleted the copilot/migrate-to-centralized-package-management branch February 26, 2026 19:12
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.

3 participants