Implement Central Package Management with Directory.Packages.props and Transitive Pinning - #1084
Merged
Merged
Conversation
Co-authored-by: glennawatson <5834289+glennawatson@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Implement Central Package Management in the Repository
Implement Central Package Management with Directory.Packages.props
Sep 4, 2025
Contributor
|
@copilot reanalyse the commit with my update, explain to a non-experienced user what the different properties in Directory.Packages.props is (including the now added transitive pinning) and what central package management is, so people looking at this PR can understand it. |
Copilot
AI
changed the title
Implement Central Package Management with Directory.Packages.props
Implement Central Package Management with Directory.Packages.props and Transitive Pinning
Sep 4, 2025
glennawatson
approved these changes
Sep 4, 2025
|
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR implements NuGet's Central Package Management (CPM) feature for the Akavache repository, centralizing all package version management in a single
Directory.Packages.propsfile located in the/srcfolder.What Changed
Created
src/Directory.Packages.propswith:<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>property to enable CPM<CentralPackageTransitivePinningEnabled>true</CentralPackageTransitivePinningEnabled>for predictable builds by locking transitive dependency versionsMicrosoftExtensionsVersion(9.0.8): System.Text.Json, Microsoft.Extensions.* packagesSqlitePclRawVersion(2.1.11): All SQLitePCLRaw.* packagesSqliteNetVersion(1.9.172): sqlite-net packagesSplatVersion(16.1.1): Splat packagesReactiveUIVersion(20.4.1): ReactiveUI packagesUpdated 15 project files to remove
Versionattributes from all<PackageReference>elements, as versions are now resolved centrally.Preserved all existing conditional logic including:
IsTestProjectconditions)SourceLinkEnabledconditions)Benefits
Technical Notes
NUnit3TestAdapter"5.*" with explicit "5.1.0" as CPM doesn't support floating versions"versionCentrallyManaged": truein project.assets.jsonFixes #1083.
Central Package Management (CPM) Explained
What is Central Package Management?
Central Package Management is a NuGet feature that allows you to manage all package versions across your entire solution from a single file (
Directory.Packages.props) instead of scattered across individual project files. Think of it like having one master list of software dependencies instead of each project maintaining its own separate list.Key Properties in Directory.Packages.props
Core CPM Settings
This enables CPM for the entire solution. When true, all projects must get their package versions from this central file instead of specifying versions in individual project files.
NEW: This enables "transitive pinning" - it locks down the versions of indirect dependencies (packages that your direct dependencies depend on). Without this, NuGet might automatically upgrade transitive dependencies, potentially causing unexpected issues. With pinning enabled, you get completely predictable builds.
Version Groups (Smart Organization)
These create reusable version variables for related packages. Instead of repeating "9.0.8" for every Microsoft.Extensions.* package, we define it once and reference it as
$(MicrosoftExtensionsVersion). This ensures related packages always stay in sync.Package Definitions
This defines that any project referencing "System.Text.Json" will get version 9.0.8 (via the variable). Projects just specify
<PackageReference Include="System.Text.Json" />without a version.Conditional Groups
These apply packages only to specific types of projects (test projects, Windows-only, etc.), keeping dependencies organized and preventing unnecessary packages in production code.
Benefits for Akavache