From 7a94ee212328ca08d98f2eb22a5e0f3e027a063b Mon Sep 17 00:00:00 2001 From: StuartFerguson Date: Sat, 13 Jun 2026 07:29:53 +0100 Subject: [PATCH] Adopt Central Package Management for NuGet dependencies Introduce Directory.Packages.props for CPM and update Directory.Build.props to import it. Remove explicit version numbers from all .csproj files, centralizing dependency versions. Update Dockerfiles to copy Directory.Packages.props. Refactor ControllerTestsBase.cs to use ValueTask for async methods and clean up unused usings. Update solution file for latest Visual Studio and add Solution Items folder. --- Directory.Build.props | 3 + Directory.Packages.props | 55 +++++++++++++++++++ ...eportingAPI.BusinessLogic.UnitTests.csproj | 16 +++--- .../EstateReportingAPI.BusinessLogic.csproj | 10 ++-- .../EstateReportingAPI.Client.csproj | 4 +- .../ControllerTestsBase.cs | 5 +- ...EstateReportingAPI.IntegrationTests.csproj | 36 ++++++------ .../FileImportLogsEndpointTests.cs | 1 - .../SettlmentsEndpointTests.cs | 1 - .../TransactionsEndpointTests.cs | 1 - .../EstateReportingAPI.csproj | 2 +- .../EstateReportingAPI.Tests.csproj | 28 +++++----- EstateReportingAPI.sln | 6 +- EstateReportingAPI/Dockerfile | 2 + EstateReportingAPI/Dockerfilewindows | 2 + EstateReportingAPI/EstateReportingAPI.csproj | 52 +++++++++--------- 16 files changed, 142 insertions(+), 82 deletions(-) create mode 100644 Directory.Build.props create mode 100644 Directory.Packages.props diff --git a/Directory.Build.props b/Directory.Build.props new file mode 100644 index 0000000..00ae648 --- /dev/null +++ b/Directory.Build.props @@ -0,0 +1,3 @@ + + + diff --git a/Directory.Packages.props b/Directory.Packages.props new file mode 100644 index 0000000..4941d07 --- /dev/null +++ b/Directory.Packages.props @@ -0,0 +1,55 @@ + + + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/EstateReportingAPI.BusinessLogic.UnitTests/EstateReportingAPI.BusinessLogic.UnitTests.csproj b/EstateReportingAPI.BusinessLogic.UnitTests/EstateReportingAPI.BusinessLogic.UnitTests.csproj index 4030e79..5f04f9e 100644 --- a/EstateReportingAPI.BusinessLogic.UnitTests/EstateReportingAPI.BusinessLogic.UnitTests.csproj +++ b/EstateReportingAPI.BusinessLogic.UnitTests/EstateReportingAPI.BusinessLogic.UnitTests.csproj @@ -10,20 +10,20 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - - + + + + + + runtime; build; native; contentfiles; analyzers; buildtransitive all - + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/EstateReportingAPI.BusinessLogic/EstateReportingAPI.BusinessLogic.csproj b/EstateReportingAPI.BusinessLogic/EstateReportingAPI.BusinessLogic.csproj index 00be78f..5a8242e 100644 --- a/EstateReportingAPI.BusinessLogic/EstateReportingAPI.BusinessLogic.csproj +++ b/EstateReportingAPI.BusinessLogic/EstateReportingAPI.BusinessLogic.csproj @@ -7,11 +7,11 @@ - - - - - + + + + + diff --git a/EstateReportingAPI.Client/EstateReportingAPI.Client.csproj b/EstateReportingAPI.Client/EstateReportingAPI.Client.csproj index 9d18e50..bd16ac6 100644 --- a/EstateReportingAPI.Client/EstateReportingAPI.Client.csproj +++ b/EstateReportingAPI.Client/EstateReportingAPI.Client.csproj @@ -7,8 +7,8 @@ - - + + diff --git a/EstateReportingAPI.IntegrationTests/ControllerTestsBase.cs b/EstateReportingAPI.IntegrationTests/ControllerTestsBase.cs index 59ff673..352ab8d 100644 --- a/EstateReportingAPI.IntegrationTests/ControllerTestsBase.cs +++ b/EstateReportingAPI.IntegrationTests/ControllerTestsBase.cs @@ -19,7 +19,6 @@ namespace EstateReportingAPI.IntegrationTests; using Shared.Logger; using Shouldly; using Xunit; -using Xunit.Abstractions; public abstract class ControllerTestsBase : IAsyncLifetime { @@ -30,7 +29,7 @@ public abstract class ControllerTestsBase : IAsyncLifetime protected DatabaseHelper helper; protected ITestOutputHelper TestOutputHelper; protected DockerHelper DockerHelper; - public virtual async Task InitializeAsync() + public virtual async ValueTask InitializeAsync() { this.TestId = Guid.NewGuid(); String scenarioName = this.TestId.ToString(); @@ -55,7 +54,7 @@ public virtual async Task InitializeAsync() await this.SetupStandingData(); } - public virtual async Task DisposeAsync() + public virtual async ValueTask DisposeAsync() { await this.DockerHelper.StopContainersForScenarioRun(DockerServices.None); } diff --git a/EstateReportingAPI.IntegrationTests/EstateReportingAPI.IntegrationTests.csproj b/EstateReportingAPI.IntegrationTests/EstateReportingAPI.IntegrationTests.csproj index b07a0fd..c351496 100644 --- a/EstateReportingAPI.IntegrationTests/EstateReportingAPI.IntegrationTests.csproj +++ b/EstateReportingAPI.IntegrationTests/EstateReportingAPI.IntegrationTests.csproj @@ -7,30 +7,30 @@ - - - - - - - + + + + + + + runtime; build; native; contentfiles; analyzers; buildtransitive all - + all runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - - - - - - + + + + + + + + + + diff --git a/EstateReportingAPI.IntegrationTests/FileImportLogsEndpointTests.cs b/EstateReportingAPI.IntegrationTests/FileImportLogsEndpointTests.cs index 321483c..eaf7835 100644 --- a/EstateReportingAPI.IntegrationTests/FileImportLogsEndpointTests.cs +++ b/EstateReportingAPI.IntegrationTests/FileImportLogsEndpointTests.cs @@ -12,7 +12,6 @@ using Shouldly; using SimpleResults; using Xunit; -using Xunit.Abstractions; namespace EstateReportingAPI.IntegrationTests { diff --git a/EstateReportingAPI.IntegrationTests/SettlmentsEndpointTests.cs b/EstateReportingAPI.IntegrationTests/SettlmentsEndpointTests.cs index e4a1be1..0fcd63a 100644 --- a/EstateReportingAPI.IntegrationTests/SettlmentsEndpointTests.cs +++ b/EstateReportingAPI.IntegrationTests/SettlmentsEndpointTests.cs @@ -6,7 +6,6 @@ using System.Threading.Tasks; using Shouldly; using Xunit; -using Xunit.Abstractions; namespace EstateReportingAPI.IntegrationTests; diff --git a/EstateReportingAPI.IntegrationTests/TransactionsEndpointTests.cs b/EstateReportingAPI.IntegrationTests/TransactionsEndpointTests.cs index debc0ae..054a97b 100644 --- a/EstateReportingAPI.IntegrationTests/TransactionsEndpointTests.cs +++ b/EstateReportingAPI.IntegrationTests/TransactionsEndpointTests.cs @@ -10,7 +10,6 @@ using SimpleResults; using TransactionProcessor.Database.Entities; using Xunit; -using Xunit.Abstractions; namespace EstateReportingAPI.IntegrationTests; diff --git a/EstateReportingAPI.Testing/EstateReportingAPI.csproj b/EstateReportingAPI.Testing/EstateReportingAPI.csproj index 2040736..198ed24 100644 --- a/EstateReportingAPI.Testing/EstateReportingAPI.csproj +++ b/EstateReportingAPI.Testing/EstateReportingAPI.csproj @@ -6,7 +6,7 @@ - + diff --git a/EstateReportingAPI.Tests/EstateReportingAPI.Tests.csproj b/EstateReportingAPI.Tests/EstateReportingAPI.Tests.csproj index 33343ca..82e66d9 100644 --- a/EstateReportingAPI.Tests/EstateReportingAPI.Tests.csproj +++ b/EstateReportingAPI.Tests/EstateReportingAPI.Tests.csproj @@ -7,26 +7,26 @@ - - - - - - + + + + + + all runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - - - + + + + + + + all runtime; build; native; contentfiles; analyzers; buildtransitive - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/EstateReportingAPI.sln b/EstateReportingAPI.sln index 07da541..96964f1 100644 --- a/EstateReportingAPI.sln +++ b/EstateReportingAPI.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 17 -VisualStudioVersion = 17.8.34004.107 +# Visual Studio Version 18 +VisualStudioVersion = 18.7.11903.348 MinimumVisualStudioVersion = 10.0.40219.1 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EstateReportingAPI", "EstateReportingAPI\EstateReportingAPI.csproj", "{8E6ED1E8-9776-49F3-ADEB-17A03318E136}" EndProject @@ -21,6 +21,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EstateReportingAPI.Models", EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EstateReportingAPI.IntegrationTests", "EstateReportingAPI.IntegrationTests\EstateReportingAPI.IntegrationTests.csproj", "{85555B3A-FC04-4291-B0CB-F0835AC23D3E}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{A296632F-ABDB-4D3E-9351-51346C70C08A}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU diff --git a/EstateReportingAPI/Dockerfile b/EstateReportingAPI/Dockerfile index 2ead79c..4e6970e 100644 --- a/EstateReportingAPI/Dockerfile +++ b/EstateReportingAPI/Dockerfile @@ -5,6 +5,8 @@ FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build WORKDIR /src COPY ["EstateReportingAPI/NuGet.Config", "."] COPY ["EstateReportingAPI/EstateReportingAPI.csproj", "EstateReportingAPI/"] +COPY ["Directory.Packages.props", "."] +COPY . . RUN dotnet restore "EstateReportingAPI/EstateReportingAPI.csproj" COPY . . WORKDIR "/src/EstateReportingAPI" diff --git a/EstateReportingAPI/Dockerfilewindows b/EstateReportingAPI/Dockerfilewindows index 413d263..d25485a 100644 --- a/EstateReportingAPI/Dockerfilewindows +++ b/EstateReportingAPI/Dockerfilewindows @@ -6,6 +6,8 @@ FROM mcr.microsoft.com/dotnet/sdk:10.0-windowsservercore-ltsc2022 AS build WORKDIR /src COPY ["EstateReportingAPI/NuGet.Config", "."] COPY ["EstateReportingAPI/EstateReportingAPI.csproj", "EstateReportingAPI/"] +COPY ["Directory.Packages.props", "."] +COPY . . RUN dotnet restore "EstateReportingAPI/EstateReportingAPI.csproj" COPY . . WORKDIR "/src/EstateReportingAPI" diff --git a/EstateReportingAPI/EstateReportingAPI.csproj b/EstateReportingAPI/EstateReportingAPI.csproj index f86bcb2..c95708d 100644 --- a/EstateReportingAPI/EstateReportingAPI.csproj +++ b/EstateReportingAPI/EstateReportingAPI.csproj @@ -9,35 +9,35 @@ - - - - - - + + + + + + - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + +