Skip to content

Migrate to Centralized NuGet Package Management (CPM)#23

Merged
Tyrrrz merged 4 commits intomasterfrom
copilot/migrate-to-cpm
Feb 26, 2026
Merged

Migrate to Centralized NuGet Package Management (CPM)#23
Tyrrrz merged 4 commits intomasterfrom
copilot/migrate-to-cpm

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Feb 26, 2026

  • Explore repo and collect all package references with versions
  • Create Directory.Packages.props at repo root with all unique packages (sorted alphabetically)
  • Remove Version="..." from all <PackageReference> elements in the 3 .csproj files
  • Add Directory.Packages.props to the Misc Solution Items folder in Gress.sln
  • Fix formatting in Directory.Packages.props to match Directory.Build.props style (blank lines after <Project>, between groups, and before </Project>)
  • Collapse multi-line Avalonia.Diagnostics PackageReference to single line now that Version attribute is removed
  • Build to verify changes are correct (all projects build successfully)
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. 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.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@Tyrrrz Tyrrrz added the enhancement New feature or request label Feb 26, 2026
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 marked this pull request as ready for review February 26, 2026 19:34
Copilot AI review requested due to automatic review settings February 26, 2026 19:34
@Tyrrrz
Copy link
Copy Markdown
Owner

Tyrrrz commented Feb 26, 2026

@copilot formatting issues

@Tyrrrz
Copy link
Copy Markdown
Owner

Tyrrrz commented Feb 26, 2026

@copilot formatting issues

Copy link
Copy Markdown

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 pull request migrates the Gress repository to use NuGet's Centralized Package Management (CPM), consolidating all package version definitions from individual .csproj files into a single Directory.Packages.props file at the repository root. This enables centralized version management across all projects in the solution, improving maintainability and consistency.

Changes:

  • Created Directory.Packages.props with all 15 package versions defined centrally and sorted alphabetically
  • Removed Version attributes from all <PackageReference> elements in project files while preserving other attributes
  • Added Directory.Packages.props to the solution's Misc folder for visibility

Reviewed changes

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

Show a summary per file
File Description
Directory.Packages.props New file defining centralized package versions with <ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally> and 15 <PackageVersion> entries
Gress/Gress.csproj Removed version attributes from 3 package references (CSharpier.MsBuild, Microsoft.SourceLink.GitHub, PolyShim), preserved PrivateAssets attributes
Gress.Tests/Gress.Tests.csproj Removed version attributes from 7 package references, preserved PrivateAssets attributes
Gress.Demo/Gress.Demo.csproj Removed version attributes from 7 package references including conditional Avalonia.Diagnostics, preserved PrivateAssets and Condition attributes
Gress.sln Added Directory.Packages.props to the Misc solution items folder

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

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

Copilot AI commented Feb 26, 2026

@copilot formatting issues

Fixed in 6bbbbf2 — added blank lines after <Project>, between <PropertyGroup> and <ItemGroup>, and before </Project> to match the style in Directory.Build.props.

…ving Version

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

Copilot AI commented Feb 26, 2026

@copilot formatting issues

Fixed in 1302ea4 — collapsed the multi-line Avalonia.Diagnostics PackageReference to a single line now that Version is no longer needed as a separate attribute.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • av-build-tel-api-v1.avaloniaui.net
    • Triggering command: /usr/share/dotnet/dotnet dotnet exec --runtimeconfig /home/REDACTED/.nuget/packages/avalonia.buildservices/11.3.2/tools/netstandard2.0/runtimeconfig.json /home/REDACTED/.nuget/packages/avalonia.buildservices/11.3.2/tools/netstandard2.0/Avalonia.BuildServices.Collector.dll (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

@Tyrrrz Tyrrrz merged commit fe0fa4b into master Feb 26, 2026
7 checks passed
@Tyrrrz Tyrrrz deleted the copilot/migrate-to-cpm branch February 26, 2026 19:44
@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 90.52%. Comparing base (fffff78) to head (1302ea4).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master      #23   +/-   ##
=======================================
  Coverage   90.52%   90.52%           
=======================================
  Files          11       11           
  Lines         190      190           
  Branches       19       19           
=======================================
  Hits          172      172           
  Misses         13       13           
  Partials        5        5           

☔ 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