Skip to content

Migrate to Centralized NuGet Package Management (CPM)#30

Merged
Tyrrrz merged 2 commits intomasterfrom
copilot/migrate-to-centralized-nuget
Feb 26, 2026
Merged

Migrate to Centralized NuGet Package Management (CPM)#30
Tyrrrz merged 2 commits intomasterfrom
copilot/migrate-to-centralized-nuget

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Feb 26, 2026

Migrates package version management from per-project Version attributes to NuGet's Centralized Package Management, consolidating all versions into a single source of truth.

Changes

  • Directory.Packages.props (new): Enables CPM via <ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>; declares all 11 package versions alphabetically
  • All .csproj files: Removed Version="..." from every <PackageReference> — all other attributes (PrivateAssets, etc.) preserved
  • Ressy.sln: Added Directory.Packages.props as a solution item under Misc

Before:

<PackageReference Include="FluentAssertions" Version="8.8.0" />
<PackageReference Include="xunit" Version="2.9.3" />

After (Directory.Packages.props):

<PackageVersion Include="FluentAssertions" Version="8.8.0" />
<PackageVersion Include="xunit" Version="2.9.3" />

After (.csproj):

<PackageReference Include="FluentAssertions" />
<PackageReference Include="xunit" />

No packages had conflicting versions across projects.

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. Add Directory.Packages.props to the .sln file as a solution item, typically under a Solution Items folder, so it is visible and accessible from within the solution.

  4. Run dotnet build at the end to catch and fix any formatting or structural issues introduced during the migration.

  5. 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.

This pull request was created from Copilot chat.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: Tyrrrz <1935960+Tyrrrz@users.noreply.github.com>
@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:44
Copilot AI review requested due to automatic review settings February 26, 2026 19:44
Copilot AI changed the title [WIP] Migrate to centralized NuGet package management Migrate to Centralized NuGet Package Management (CPM) Feb 26, 2026
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

Migrates the solution to NuGet Central Package Management (CPM) by centralizing all package versions in a root Directory.Packages.props, keeping project files free of per-reference versions and making the CPM file visible in the solution.

Changes:

  • Add root Directory.Packages.props enabling CPM and defining all package versions.
  • Remove Version="..." attributes from all <PackageReference> entries across projects.
  • Add Directory.Packages.props to Ressy.sln solution items.

Reviewed changes

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

Show a summary per file
File Description
Directory.Packages.props Introduces centralized package version declarations and enables CPM.
Ressy/Ressy.csproj Removes per-package Version attributes to defer to CPM.
Ressy.Tests/Ressy.Tests.csproj Removes per-package Version attributes to defer to CPM.
Ressy.Tests.Dummy/Ressy.Tests.Dummy.csproj Removes per-package Version attributes to defer to CPM.
Ressy.Demo/Ressy.Demo.csproj Removes per-package Version attributes to defer to CPM.
Ressy.sln Adds Directory.Packages.props as a solution item under Misc.
Ressy/Versions/VersionExtensions.cs Whitespace-only formatting adjustment.
Ressy/Strings/StringTableExtensions.cs Whitespace-only formatting adjustment.
Ressy/Manifests/ManifestExtensions.cs Whitespace-only formatting adjustment.
Ressy/Icons/IconExtensions.cs Whitespace-only formatting adjustment.

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

@Tyrrrz Tyrrrz merged commit e26591a into master Feb 26, 2026
11 checks passed
@Tyrrrz Tyrrrz deleted the copilot/migrate-to-centralized-nuget branch February 26, 2026 19:50
@codecov
Copy link
Copy Markdown

codecov bot commented Feb 26, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.49%. Comparing base (3b8e788) to head (53412fb).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master      #30   +/-   ##
=======================================
  Coverage   83.49%   83.49%           
=======================================
  Files          36       36           
  Lines        1509     1509           
  Branches      232      232           
=======================================
  Hits         1260     1260           
  Misses        160      160           
  Partials       89       89           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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