Skip to content

Migrate to Centralized NuGet Package Management (CPM)#788

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

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

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Feb 26, 2026

  • Explore repository structure and .csproj files
  • Create Directory.Packages.props with all package versions sorted alphabetically
  • Update YoutubeDownloader/YoutubeDownloader.csproj to remove Version attributes from <PackageReference> elements
  • Update YoutubeDownloader.Core/YoutubeDownloader.Core.csproj to remove Version attributes from <PackageReference> elements
  • Add Directory.Packages.props to the Misc solution folder in YoutubeDownloader.sln
  • Fix CSharpier formatting: collapse Avalonia.Diagnostics <PackageReference> to single line (no longer needs multi-line after Version removed)
  • Verified dotnet build -t:CSharpierFormat passes with no errors
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

Projects in this repo

  • YoutubeDownloader/YoutubeDownloader.csproj
  • YoutubeDownloader.Core/YoutubeDownloader.Core.csproj

There may also be a test project — check the repo for any additional .csproj files.

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 xmlns or is a valid MSBuild props file: <Project> root element.

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: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 PR migrates the solution to NuGet Central Package Management (CPM) by moving all NuGet package versions out of individual .csproj files into a single root-level Directory.Packages.props.

Changes:

  • Added Directory.Packages.props with ManagePackageVersionsCentrally=true and centralized PackageVersion entries.
  • Removed per-PackageReference Version="..." attributes from YoutubeDownloader.csproj.
  • Removed per-PackageReference Version="..." attributes from YoutubeDownloader.Core.csproj.

Reviewed changes

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

File Description
Directory.Packages.props Introduces centralized package versions for all packages used by the solution.
YoutubeDownloader/YoutubeDownloader.csproj Drops Version attributes from all PackageReference items while preserving other metadata (e.g., Condition, PrivateAssets).
YoutubeDownloader.Core/YoutubeDownloader.Core.csproj Drops Version attributes from all PackageReference items while preserving other metadata.

💡 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 commit 9af442f:

  • Added Directory.Packages.props to the Misc solution folder in YoutubeDownloader.sln
  • Fixed the formatting failure by collapsing the Avalonia.Diagnostics <PackageReference> to a single line (it only has one attribute left after removing Version, so CSharpier wants it inline)

dotnet build -t:CSharpierFormat now passes cleanly.

@Tyrrrz Tyrrrz merged commit 9d35d87 into master Feb 26, 2026
18 checks passed
@Tyrrrz Tyrrrz deleted the copilot/migrate-to-centralized-package-management branch February 26, 2026 19:26
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