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.0 — Raygun4Maui.csproj and Raygun4Maui.SampleApp.csproj
Microsoft.Extensions.Configuration.UserSecrets 10.0.0 — Raygun4Maui.SampleApp.csproj
Microsoft.Extensions.Hosting.Abstractions 10.0.0 — Raygun4Maui.SampleApp.csproj
Mindscape.Raygun4Net.NetCore 11.2.1 — Raygun4Maui.csproj
K4os.Compression.LZ4 1.3.8 — Raygun4Maui.csproj (Android-only ItemGroup)
Serilog.Sinks.Raygun 7.3.0 — Raygun4Maui.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
- Add
Directory.Packages.props at the repo root with <ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally> and one <PackageVersion Include="..." Version="..." /> per dependency above.
- Remove the
Version attribute from every <PackageReference> in the csproj files.
- 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
- 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
Background
PR #39 (the .NET 10 migration) introduced a partial centralisation by moving
<Version>toDirectory.Build.propssoRaygun4MauiandRaygun4Maui.Platformalways 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 newDirectory.Packages.propsat the repo root, so each version is declared once.Currently duplicated / scattered
Microsoft.Extensions.Hosting 10.0.0—Raygun4Maui.csprojandRaygun4Maui.SampleApp.csprojMicrosoft.Extensions.Configuration.UserSecrets 10.0.0—Raygun4Maui.SampleApp.csprojMicrosoft.Extensions.Hosting.Abstractions 10.0.0—Raygun4Maui.SampleApp.csprojMindscape.Raygun4Net.NetCore 11.2.1—Raygun4Maui.csprojK4os.Compression.LZ4 1.3.8—Raygun4Maui.csproj(Android-only ItemGroup)Serilog.Sinks.Raygun 7.3.0—Raygun4Maui.SampleApp.csprojMicrosoft.Maui.Controls $(MauiVersion)—Raygun4Maui.csprojandRaygun4Maui.SampleApp.csproj(already centralised via the workload-supplied$(MauiVersion), but the<PackageVersion>entry still belongs in the central file for consistency)Proposed steps
Directory.Packages.propsat the repo root with<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>and one<PackageVersion Include="..." Version="..." />per dependency above.Versionattribute from every<PackageReference>in the csproj files.dotnet build Raygun4Maui.Platform/Raygun4Maui.Platform.csproj -c Releasedotnet build Raygun4Maui/Raygun4Maui.csproj -c Releasedotnet build Raygun4Maui.SampleApp/Raygun4Maui.SampleApp.csproj -c Debug -f net10.0-androiddotnet build Raygun4Maui.SampleApp/Raygun4Maui.SampleApp.csproj -c Debug -f net10.0-iosRaygun4Maui.3.0.x.nupkgandRaygun4Maui.Platform.3.0.x.nupkgresolve cleanly from a real consumer project.Benefits
Notes
Microsoft.Maui.Controlsreference will still resolve via the workload-supplied$(MauiVersion)rather than a hard-pinned literal — that's intentional and matches Microsoft's recommendation.References