Skip to content

Migrate to Centralized NuGet Package Management (CPM)#416

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

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

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Feb 26, 2026

  • Create Directory.Packages.props with all package versions (alphabetically sorted)
  • Update LightBulb/LightBulb.csproj to remove Version attributes
  • Update LightBulb.Core/LightBulb.Core.csproj to remove Version attributes
  • Update LightBulb.Core.Tests/LightBulb.Core.Tests.csproj to remove Version attributes
  • Update LightBulb.PlatformInterop/LightBulb.PlatformInterop.csproj to remove Version attributes
  • Add Directory.Packages.props to the Misc solution folder in LightBulb.sln
  • Fix CSharpier formatting: collapse Avalonia.Diagnostics PackageReference to single line (only 2 attrs remain after removing Version)
  • Build succeeds with CSharpier format check passing
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.

This pull request was created from Copilot chat.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Co-authored-by: Tyrrrz <1935960+Tyrrrz@users.noreply.github.com>
Copilot AI changed the title [WIP] Migrate repository 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:02
Copilot AI review requested due to automatic review settings February 26, 2026 19:02
@Tyrrrz
Copy link
Copy Markdown
Owner

Tyrrrz commented Feb 26, 2026

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

Also, formatting fails

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 pull request migrates the LightBulb repository from per-project package version management to NuGet's Centralized Package Management (CPM). All package versions are consolidated into a new Directory.Packages.props file at the repository root, while individual project files retain their PackageReference elements without version attributes.

Changes:

  • Created Directory.Packages.props with 19 centralized package versions
  • Removed Version attributes from all PackageReference elements across 4 project files
  • Preserved all other attributes (PrivateAssets, Condition) on package references

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 enabled and 19 PackageVersion entries in alphabetical order
LightBulb/LightBulb.csproj Removed Version attributes from 12 PackageReference elements while preserving PrivateAssets and Condition attributes
LightBulb.PlatformInterop/LightBulb.PlatformInterop.csproj Removed Version attribute from CSharpier.MsBuild PackageReference while preserving PrivateAssets
LightBulb.Core/LightBulb.Core.csproj Removed Version attributes from 2 PackageReference elements while preserving PrivateAssets
LightBulb.Core.Tests/LightBulb.Core.Tests.csproj Removed Version attributes from 7 PackageReference elements while preserving PrivateAssets

💡 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 add the created Directory.Packages.props file to the sln file

Also, formatting fails

Done in b35b83a:

  • Added Directory.Packages.props to the Misc solution folder in LightBulb.sln
  • Fixed the CSharpier formatting failure: after removing Version, the Avalonia.Diagnostics <PackageReference> was left with only 2 attributes, so CSharpier now expects it on a single line (instead of the previous multi-line form)

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 1d04763 into master Feb 26, 2026
8 checks passed
@Tyrrrz Tyrrrz deleted the copilot/migrate-to-centralized-package-management branch February 26, 2026 19:25
@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 96.35%. Comparing base (4cb6fa2) to head (b35b83a).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #416   +/-   ##
=======================================
  Coverage   96.35%   96.35%           
=======================================
  Files           7        7           
  Lines         192      192           
  Branches       15       15           
=======================================
  Hits          185      185           
  Misses          6        6           
  Partials        1        1           

☔ 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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants