Repository navigation
Description
Problem
Shared configuration is copy-pasted across the solution.
Package metadata is duplicated in all 10 packable projects. Each one repeats an identical block:
<Version>2.1.0</Version>
<Authors>Romain-OD</Authors>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageProjectUrl>https://github.com/Romain-OD/MessageValidation</PackageProjectUrl>
<RepositoryUrl>https://github.com/Romain-OD/MessageValidation</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageReadmeFile>README.md</PackageReadmeFile>
<PackageIcon>MessageValidation-logo.png</PackageIcon>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<TargetFramework>net10.0</TargetFramework>
<Nullable>enable</Nullable>
<LangVersion>14.0</LangVersion>Cutting a release therefore means editing <Version> in 10 separate files and getting all 10 right. One missed file ships a package at the wrong version, and the mistake is invisible until it is on NuGet.org and immutable.
Dependency versions are duplicated across all 22 projects. Microsoft.Extensions.* at 10.0.5 appears in roughly 14 files; xunit 2.9.3, Microsoft.NET.Test.Sdk 18.3.0, xunit.runner.visualstudio 3.1.5, and NSubstitute 5.3.0 each appear in about 10. Nothing prevents two projects from silently drifting to different versions of the same package.
This is maintainer friction rather than a consumer-facing defect, but it directly raises the cost and risk of every release — which is exactly what makes releases infrequent.
Proposed change
1. Directory.Build.props at the repository root — shared metadata and compiler settings in one place, with a single <Version>:
<Project>
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<LangVersion>14.0</LangVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(IsPackable)' != 'false'">
<Version>2.1.0</Version>
<Authors>Romain-OD</Authors>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageProjectUrl>https://github.com/Romain-OD/MessageValidation</PackageProjectUrl>
<RepositoryUrl>https://github.com/Romain-OD/MessageValidation</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageReadmeFile>README.md</PackageReadmeFile>
<PackageIcon>MessageValidation-logo.png</PackageIcon>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup>
</Project>Each .csproj then keeps only what is genuinely its own: PackageId, Description, PackageTags, and its PackageReference / ProjectReference items.
2. Directory.Packages.props — central package management:
<Project>
<PropertyGroup>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="Microsoft.Extensions.Logging" Version="10.0.5" />
<PackageVersion Include="xunit" Version="2.9.3" />
<!-- ... -->
</ItemGroup>
</Project>Individual projects drop the Version attribute: <PackageReference Include="xunit" />.
Follow-on, not part of this issue
Once metadata is centralized, <EnablePackageValidation>true</EnablePackageValidation> with PackageValidationBaselineVersion becomes a one-line addition and would catch accidental breaking API changes against the previously shipped version.
Acceptance criteria
-
Directory.Build.propsholds the shared metadata; a release requires changing<Version>in exactly one file -
Directory.Packages.propsexists withManagePackageVersionsCentrally, and no.csprojcarries an inlineVersionattribute - Each
.csprojretains its ownPackageId,Description, andPackageTags -
dotnet build MessageValidation.slnx -c Releasesucceeds with no new warnings -
dotnet packoutput is byte-equivalent in metadata to the current 2.1.0 packages (same version, license, icon, readme, docs XML)
Activity
Multi-target net8.0 alongside net10.0 (#11)