Skip to content

Centralize NuGet package versions with Directory.Packages.props#37

Merged
mpaulosky merged 2 commits into
sprint/1-foundationfrom
copilot/fix-60372079-1212814810-77a6f077-1276-4064-9242-3498b996b2ec
Apr 19, 2026
Merged

Centralize NuGet package versions with Directory.Packages.props#37
mpaulosky merged 2 commits into
sprint/1-foundationfrom
copilot/fix-60372079-1212814810-77a6f077-1276-4064-9242-3498b996b2ec

Conversation

Copilot AI commented Apr 19, 2026

Copy link
Copy Markdown
Contributor

Summary

Centralized NuGet version management across src/ and tests/ to eliminate per-project version drift and align with the Phase 2 package governance requirement.

  • Scope
    • Added root-level Directory.Packages.props with all unique package versions currently used by solution projects.
    • Enabled central version management via ManagePackageVersionsCentrally.
    • Removed inline Version attributes from project PackageReference entries so they resolve from the central file.
    • Dependabot nuget update target remains at root (directory: "/"), matching centralized package management.

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✨ Feature (non-breaking change that adds functionality)
  • ♻️ Refactor (no behavior change, code cleanup/restructure)
  • 🧪 Tests (new or updated tests only)
  • 📝 Docs (README, XML docs, comments)
  • ⚙️ Infra/CI (GitHub Actions, Aspire, NuGet, deployment)
  • 🔒 Security (auth, permissions, secrets, headers)
  • 💥 Breaking change (existing behavior changes)

Domain Affected

  • 🏗️ Architecture / domain logic / CQRS → Aragorn required
  • 🔧 Backend (handlers, repositories, API endpoints, MediatR) → Sam required
  • ⚛️ Frontend (Blazor components, Razor pages, CSS, JS) → Legolas required
  • 🧪 Unit / bUnit / integration tests → Gimli required
  • 🧪 E2E / Playwright / Aspire integration tests → Pippin required
  • ⚙️ CI/CD / GitHub Actions / NuGet / Aspire AppHost → Boromir required
  • 🔒 Auth0 / authorization / security-relevant changes → Gandalf required
  • 📝 Docs / README / XML docs → Frodo required

Self-Review Checklist

Code Quality

  • I ran dotnet build MyBlog.slnx --configuration Release — 0 errors, 0 warnings
  • I ran dotnet test MyBlog.slnx --configuration Release --no-build — all pass
  • No TODO/FIXME left unless tracked in a follow-up issue (link it)
  • No secrets, API keys, or credentials committed

Architecture

  • New handlers follow the Command/Query/Handler/Validator naming conventions
  • New handlers are sealed
  • Domain layer has no references to Web or Persistence.* projects
  • Result<T> / ResultErrorCode used for expected failures (no exception-driven control flow)
  • DTOs are records in Domain.DTOs; Models are in Domain.Models
  • No DTO types embedded in Model classes

Tests

  • New code has corresponding unit tests
  • Integration tests use domain-specific collections ([Collection("XxxIntegration")])
  • No test compares two IssueDto.Empty / CommentDto.Empty instances directly

Security (check if security-relevant)

  • New endpoints have appropriate RequireAuthorization / policy applied
  • No MarkupString used with user-supplied content
  • No user input reflected in MongoDB queries without sanitization

Merge Readiness

  • Branch is up to date with main (no merge conflicts)
  • CI checks are green (do not request review while checks are pending/failing)
  • PR description is complete — reviewers should not have to ask what this does

Screenshots / Evidence

<!-- Directory.Packages.props -->
<Project>
  <ItemGroup>
    <PackageVersion Include="MediatR" Version="14.1.0" />
    <PackageVersion Include="MongoDB.EntityFrameworkCore" Version="10.0.1" />
    <!-- ...all other unique package versions... -->
  </ItemGroup>
</Project>

<!-- Example csproj migration -->
<PackageReference Include="MediatR" />

Notes for Reviewers

Please focus review on:

  • Completeness of Directory.Packages.props package/version coverage vs. all src/ + tests/ project references.
  • Any package/version that should remain project-local (none identified).

Copilot AI changed the title [WIP] Copilot Request Centralize NuGet package versions with Directory.Packages.props Apr 19, 2026
Copilot AI requested a review from mpaulosky April 19, 2026 19:06
@mpaulosky
mpaulosky marked this pull request as ready for review April 19, 2026 19:11
Copilot AI review requested due to automatic review settings April 19, 2026 19:11
@mpaulosky
mpaulosky merged commit b6dbc6d into sprint/1-foundation Apr 19, 2026
4 checks passed
@mpaulosky
mpaulosky deleted the copilot/fix-60372079-1212814810-77a6f077-1276-4064-9242-3498b996b2ec branch April 19, 2026 19:13

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Centralizes NuGet package version management across the solution by introducing central package version definitions and removing per-project version declarations to prevent version drift.

Changes:

  • Added root Directory.Packages.props defining all package versions used across src/ and tests/.
  • Enabled central package management (ManagePackageVersionsCentrally) at the repo level.
  • Removed Version="..." attributes from PackageReference entries in multiple projects.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
tests/Unit.Tests/Unit.Tests.csproj Removes per-reference versions so packages resolve from central versions
tests/Integration.Tests/Integration.Tests.csproj Same migration to central versions for integration test dependencies
tests/Architecture.Tests/Architecture.Tests.csproj Same migration to central versions for architecture test dependencies
src/Web/Web.csproj Switches web project package refs to centrally-managed versions
src/ServiceDefaults/ServiceDefaults.csproj Switches service defaults package refs to centrally-managed versions
src/AppHost/AppHost.csproj Switches Aspire AppHost package refs to centrally-managed versions
Directory.Packages.props Adds central package version declarations
Directory.Build.props Enables MSBuild central package management globally

Comment on lines +18 to +28
<PackageReference Include="bunit" />
<PackageReference Include="coverlet.collector" />
<PackageReference Include="coverlet.msbuild">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="FluentAssertions" Version="8.9.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.4.0" />
<PackageReference Include="NSubstitute" Version="5.3.0" />
<PackageReference Include="xunit" Version="2.9.3" />
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.5" />
<PackageReference Include="FluentAssertions" />
<PackageReference Include="Microsoft.NET.Test.Sdk" />
<PackageReference Include="NSubstitute" />
<PackageReference Include="xunit" />
<PackageReference Include="xunit.runner.visualstudio" />

Copilot AI Apr 19, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

coverlet.collector and xunit.runner.visualstudio are typically intended to be test-only dependencies and should be marked as private assets to prevent them from flowing transitively if the project is ever referenced/packed. Consider adding PrivateAssets="all" (and, for coverlet.collector, IncludeAssets="runtime; build; native; contentfiles; analyzers; buildtransitive"), similar to what you already do for coverlet.msbuild.

Copilot uses AI. Check for mistakes.
Comment on lines +13 to +20
<PackageReference Include="Aspire.Hosting.Testing" />
<PackageReference Include="coverlet.collector" />
<PackageReference Include="FluentAssertions" />
<PackageReference Include="Microsoft.NET.Test.Sdk" />
<PackageReference Include="NSubstitute" />
<PackageReference Include="Testcontainers.MongoDb" />
<PackageReference Include="xunit" />
<PackageReference Include="xunit.runner.visualstudio" />

Copilot AI Apr 19, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as Unit.Tests: coverlet.collector and xunit.runner.visualstudio should generally be private assets. Adding PrivateAssets="all" (and appropriate IncludeAssets for coverlet) avoids accidental propagation and keeps dependency graphs cleaner.

Copilot uses AI. Check for mistakes.
Comment on lines +12 to +17
<PackageReference Include="coverlet.collector" />
<PackageReference Include="FluentAssertions" />
<PackageReference Include="Microsoft.NET.Test.Sdk" />
<PackageReference Include="NetArchTest.Rules" />
<PackageReference Include="xunit" />
<PackageReference Include="xunit.runner.visualstudio" />

Copilot AI Apr 19, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

coverlet.collector and xunit.runner.visualstudio should generally be marked with PrivateAssets="all" (and coverlet IncludeAssets), consistent with typical test-project dependency hygiene and to prevent unintended transitive exposure.

Copilot uses AI. Check for mistakes.
Comment thread Directory.Build.props
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>

Copilot AI Apr 19, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider moving (or duplicating) ManagePackageVersionsCentrally into Directory.Packages.props as well, so the “central package management” switch lives alongside the central version declarations. This can reduce confusion for future maintainers and makes the central package file more self-describing when viewed in isolation.

Copilot uses AI. Check for mistakes.
Comment thread Directory.Packages.props
Comment on lines +3 to +29
<PackageVersion Include="Aspire.Hosting.MongoDB" Version="13.2.2" />
<PackageVersion Include="Aspire.Hosting.Redis" Version="13.2.2" />
<PackageVersion Include="Aspire.Hosting.Testing" Version="13.2.2" />
<PackageVersion Include="Aspire.MongoDB.Driver" Version="13.2.2" />
<PackageVersion Include="Aspire.StackExchange.Redis.DistributedCaching" Version="13.2.2" />
<PackageVersion Include="Auth0.AspNetCore.Authentication" Version="1.7.0" />
<PackageVersion Include="Auth0.ManagementApi" Version="8.1.0" />
<PackageVersion Include="bunit" Version="2.7.2" />
<PackageVersion Include="coverlet.collector" Version="10.0.0" />
<PackageVersion Include="coverlet.msbuild" Version="10.0.0" />
<PackageVersion Include="FluentAssertions" Version="8.9.0" />
<PackageVersion Include="MediatR" Version="14.1.0" />
<PackageVersion Include="Microsoft.Bcl.AsyncInterfaces" Version="9.0.6" />
<PackageVersion Include="Microsoft.Extensions.Http.Resilience" Version="10.5.0" />
<PackageVersion Include="Microsoft.Extensions.ServiceDiscovery" Version="10.5.0" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="18.4.0" />
<PackageVersion Include="MongoDB.EntityFrameworkCore" Version="10.0.1" />
<PackageVersion Include="NetArchTest.Rules" Version="1.3.2" />
<PackageVersion Include="NSubstitute" Version="5.3.0" />
<PackageVersion Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" Version="1.15.2" />
<PackageVersion Include="OpenTelemetry.Extensions.Hosting" Version="1.15.2" />
<PackageVersion Include="OpenTelemetry.Instrumentation.AspNetCore" Version="1.15.1" />
<PackageVersion Include="OpenTelemetry.Instrumentation.Http" Version="1.15.0" />
<PackageVersion Include="OpenTelemetry.Instrumentation.Runtime" Version="1.15.0" />
<PackageVersion Include="Testcontainers.MongoDb" Version="4.11.0" />
<PackageVersion Include="xunit" Version="2.9.3" />
<PackageVersion Include="xunit.runner.visualstudio" Version="3.1.5" />

Copilot AI Apr 19, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With this file becoming the single source of truth, keeping PackageVersion entries consistently ordered (e.g., alphabetically by Include) will make future updates and diffs easier to review and reduces the chance of duplicate/missed entries as the list grows.

Copilot uses AI. Check for mistakes.
mpaulosky added a commit that referenced this pull request Apr 19, 2026
Closes #32

Add missing shared build properties per PRD requirements:
- LangVersion=latest — always use the latest C# language version
- EnableNETAnalyzers=true — enable .NET platform analyzers
- AnalysisMode=All — enable all analyzer rules
- EnforceCodeStyleInBuild=true — enforce .editorconfig code style at build time
- CodeAnalysisTreatWarningsAsErrors=false — allow analyzer diagnostics
  as warnings without failing CI (TreatWarningsAsErrors remains true for
  compiler errors)

ManagePackageVersionsCentrally=true was already added by PR #37 and lives
in Directory.Build.props; not duplicated here.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
mpaulosky added a commit that referenced this pull request Apr 20, 2026
## Summary

Closes #32

Working as Sam (Backend Developer)

Adds the remaining PRD-required shared build properties to
`Directory.Build.props`.

## Changes

| Property | Value | Reason |
|----------|-------|--------|
| `LangVersion` | `latest` | Always use newest C# features |
| `EnableNETAnalyzers` | `true` | Enable .NET platform analyzers |
| `AnalysisMode` | `All` | Full analyzer rule coverage |
| `EnforceCodeStyleInBuild` | `true` | Enforce `.editorconfig` style at
build time |
| `CodeAnalysisTreatWarningsAsErrors` | `false` | Analyzer diagnostics
remain warnings; compiler errors still fail via
`TreatWarningsAsErrors=true` |

`ManagePackageVersionsCentrally=true` (PR #37) is **not** duplicated.

## Acceptance Criteria

- [x] `Directory.Build.props` contains all PRD-required shared build
properties
- [x] `CodeAnalysisTreatWarningsAsErrors=false` prevents analyzer rules
from breaking CI
- [x] No individual `.csproj` overrides conflict with the new properties
- [ ] `dotnet build MyBlog.slnx --configuration Release` passes (CI
validates)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Directory.Packages.props — centralized NuGet version management

3 participants