dennisdoomen / dennisdoomen/dotnet-library-starter-kit

[Feature]: Adopt Central Package Management for the generated solutions

Open
#110 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
C#
Stars
77
Forks
5
PR merge metrics
No merged PRs in 30d

Description

### Background and motivation

Package versions are currently repeated across the generated projects: analyzers in `Directory.Build.props`, test packages in `MyPackage.Specs.csproj`, more in `MyPackage.ApiVerificationTests.csproj`, and more again in the build project. Keeping shared versions aligned is manual work, and Dependabot has to open a separate pull request per file.

[Central Package Management](https://learn.microsoft.com/en-us/nuget/consume-packages/central-package-management) moves every version into a single `Directory.Packages.props`, so projects reference packages without versions. It is well supported by Dependabot and by the IDEs.

Proposal: add a `Directory.Packages.props` to the templates and strip the versions from the individual project files.

### Alternative Concerns

* The build project (`Build/_build.csproj`) sits outside the main solution and has its own `Directory.Build.props`, so it may need either its own file or a deliberate opt-out via `ManagePackageVersionsCentrally`.
* Some conditional references differ per variant (for example FluentAssertions 7 versus 8 depending on whether the library is open source), so the templating needs care to keep those conditions working.
* Central Package Management adds a level of indirection that newcomers may find surprising, so it is worth a line in the generated README.

### Could you help with a pull-request?

No

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the package versions in Directory.Build.props, MyPackage.Specs.csproj, MyPackage.ApiVerificationTests.csproj, and the build project’s _build.csproj. Check how the generated templates handle conditional package references and the build project’s separate Directory.Build.props. Done means versions are centralized in Directory.Packages.props, project references remain versionless, conditions still work, and the generated README explains the indirection.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
build-system
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.