Skip to content

Adopt Central Package Management (CPM) #40

Description

@velocitysystems

Background

PR #39 (the .NET 10 migration) introduced a partial centralisation by moving <Version> to Directory.Build.props so Raygun4Maui and Raygun4Maui.Platform always release in lockstep. The natural next step is to adopt full Central Package Management for dependency versions as well.

CPM was kept out of #39 to limit review surface and to keep the rollback story for the major framework bump unambiguous.

Goal

Move all <PackageReference Version="..." /> versions out of the per-project csproj files and into a new Directory.Packages.props at the repo root, so each version is declared once.

Currently duplicated / scattered

  • Microsoft.Extensions.Hosting 10.0.0Raygun4Maui.csproj and Raygun4Maui.SampleApp.csproj
  • Microsoft.Extensions.Configuration.UserSecrets 10.0.0Raygun4Maui.SampleApp.csproj
  • Microsoft.Extensions.Hosting.Abstractions 10.0.0Raygun4Maui.SampleApp.csproj
  • Mindscape.Raygun4Net.NetCore 11.2.1Raygun4Maui.csproj
  • K4os.Compression.LZ4 1.3.8Raygun4Maui.csproj (Android-only ItemGroup)
  • Serilog.Sinks.Raygun 7.3.0Raygun4Maui.SampleApp.csproj
  • Microsoft.Maui.Controls $(MauiVersion)Raygun4Maui.csproj and Raygun4Maui.SampleApp.csproj (already centralised via the workload-supplied $(MauiVersion), but the <PackageVersion> entry still belongs in the central file for consistency)

Proposed steps

  1. Add Directory.Packages.props at the repo root with <ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally> and one <PackageVersion Include="..." Version="..." /> per dependency above.
  2. Remove the Version attribute from every <PackageReference> in the csproj files.
  3. Verify build:
    • dotnet build Raygun4Maui.Platform/Raygun4Maui.Platform.csproj -c Release
    • dotnet build Raygun4Maui/Raygun4Maui.csproj -c Release
    • dotnet build Raygun4Maui.SampleApp/Raygun4Maui.SampleApp.csproj -c Debug -f net10.0-android
    • dotnet build Raygun4Maui.SampleApp/Raygun4Maui.SampleApp.csproj -c Debug -f net10.0-ios
  4. Confirm produced Raygun4Maui.3.0.x.nupkg and Raygun4Maui.Platform.3.0.x.nupkg resolve cleanly from a real consumer project.

Benefits

  • Single source of truth for dependency versions; eliminates drift between projects.
  • Simpler dependency bumps (one file, one PR per upgrade).
  • First-class support in Dependabot and Renovate.
  • Easier security audits — diff one file rather than every csproj.

Notes

  • Microsoft published .NET 10 MAUI packages with CPM-formatted snippets, so MAUI 10 fully supports this pattern.
  • The Microsoft.Maui.Controls reference will still resolve via the workload-supplied $(MauiVersion) rather than a hard-pinned literal — that's intentional and matches Microsoft's recommendation.

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions