From fc109353292ee83ba4087f2808aa0cc8532acb09 Mon Sep 17 00:00:00 2001 From: StuartFerguson Date: Fri, 12 Jun 2026 15:55:57 +0100 Subject: [PATCH 1/2] Centralize NuGet package version management Adopt Directory.Packages.props and Directory.Build.props for centralized package versioning. Remove explicit version numbers from project files and update the solution structure to include solution folders and the new props file. This streamlines dependency management and simplifies future updates. --- TestHosts/Directory.Build.props | 8 ++++ TestHosts/Directory.Packages.props | 39 ++++++++++++++++ .../TestHosts.Clients.csproj | 4 +- .../TestHosts.IntegrationTests.csproj | 18 ++++---- TestHosts/TestHosts.sln | 15 +++++++ TestHosts/TestHosts/TestHosts.csproj | 44 +++++++++---------- .../WebApplication1/WebApplication1.csproj | 2 +- 7 files changed, 96 insertions(+), 34 deletions(-) create mode 100644 TestHosts/Directory.Build.props create mode 100644 TestHosts/Directory.Packages.props diff --git a/TestHosts/Directory.Build.props b/TestHosts/Directory.Build.props new file mode 100644 index 0000000..76b58e1 --- /dev/null +++ b/TestHosts/Directory.Build.props @@ -0,0 +1,8 @@ + + + + true + + PackageReference + + diff --git a/TestHosts/Directory.Packages.props b/TestHosts/Directory.Packages.props new file mode 100644 index 0000000..b7c7de9 --- /dev/null +++ b/TestHosts/Directory.Packages.props @@ -0,0 +1,39 @@ + + + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/TestHosts/TestHosts.Clients/TestHosts.Clients.csproj b/TestHosts/TestHosts.Clients/TestHosts.Clients.csproj index 18de541..64ce7f8 100644 --- a/TestHosts/TestHosts.Clients/TestHosts.Clients.csproj +++ b/TestHosts/TestHosts.Clients/TestHosts.Clients.csproj @@ -6,8 +6,8 @@ enable - - + + diff --git a/TestHosts/TestHosts.IntegrationTests/TestHosts.IntegrationTests.csproj b/TestHosts/TestHosts.IntegrationTests/TestHosts.IntegrationTests.csproj index 588eb1a..2e183f2 100644 --- a/TestHosts/TestHosts.IntegrationTests/TestHosts.IntegrationTests.csproj +++ b/TestHosts/TestHosts.IntegrationTests/TestHosts.IntegrationTests.csproj @@ -7,15 +7,15 @@ - - - - - - - - - + + + + + + + + + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/TestHosts/TestHosts.sln b/TestHosts/TestHosts.sln index d0b67a4..097d655 100644 --- a/TestHosts/TestHosts.sln +++ b/TestHosts/TestHosts.sln @@ -11,6 +11,15 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestHosts.DataTransferObjec EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestHosts.Clients", "TestHosts.Clients\TestHosts.Clients.csproj", "{4E96C5C3-9ABD-44B6-9047-64A78BF40B09}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{50B827EF-9E58-48D0-9CD9-6F32B2DF236A}" + ProjectSection(SolutionItems) = preProject + Directory.Packages.props = Directory.Packages.props + EndProjectSection +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{EE95A101-2EFF-4E8E-A603-1587901B6319}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{208122B0-E9C8-402B-AAA0-354082F8058E}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -37,6 +46,12 @@ Global GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {2AA295CE-3480-4206-A4AE-47112F00BF8F} = {EE95A101-2EFF-4E8E-A603-1587901B6319} + {E242FAB3-8F81-43E4-B76A-654F876DB840} = {208122B0-E9C8-402B-AAA0-354082F8058E} + {EF0A5414-7D16-486A-A042-790C6768B7F4} = {EE95A101-2EFF-4E8E-A603-1587901B6319} + {4E96C5C3-9ABD-44B6-9047-64A78BF40B09} = {EE95A101-2EFF-4E8E-A603-1587901B6319} + EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {B1819E4D-394A-48C4-B9EC-1E7D0B0D4764} EndGlobalSection diff --git a/TestHosts/TestHosts/TestHosts.csproj b/TestHosts/TestHosts/TestHosts.csproj index 8342f60..2b5a6d3 100644 --- a/TestHosts/TestHosts/TestHosts.csproj +++ b/TestHosts/TestHosts/TestHosts.csproj @@ -11,31 +11,31 @@ - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + all runtime; build; native; contentfiles; analyzers; buildtransitive - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/TestHosts/WebApplication1/WebApplication1.csproj b/TestHosts/WebApplication1/WebApplication1.csproj index 5c66f0f..44ebe66 100644 --- a/TestHosts/WebApplication1/WebApplication1.csproj +++ b/TestHosts/WebApplication1/WebApplication1.csproj @@ -6,6 +6,6 @@ enable - + From 0cc2a4e99ba67cf76eb59daf3f0f95415d1c0315 Mon Sep 17 00:00:00 2001 From: StuartFerguson Date: Fri, 12 Jun 2026 16:01:54 +0100 Subject: [PATCH 2/2] Add COPY for Directory.Packages.props in Dockerfiles Ensure Directory.Packages.props is copied to the build context in both Dockerfile and Dockerfilewindows to support shared NuGet package version management during the build process. --- TestHosts/TestHosts/Dockerfile | 2 ++ TestHosts/TestHosts/Dockerfilewindows | 2 ++ 2 files changed, 4 insertions(+) diff --git a/TestHosts/TestHosts/Dockerfile b/TestHosts/TestHosts/Dockerfile index 24ce0d7..b8ec6f0 100644 --- a/TestHosts/TestHosts/Dockerfile +++ b/TestHosts/TestHosts/Dockerfile @@ -5,6 +5,8 @@ FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build WORKDIR /src COPY ["TestHosts/TestHosts.csproj", "TestHosts/"] COPY ["TestHosts/NuGet.Config", "TestHosts/"] +COPY ["Directory.Packages.props", "."] +COPY . . RUN dotnet restore "TestHosts/TestHosts.csproj" COPY . . WORKDIR "/src/TestHosts" diff --git a/TestHosts/TestHosts/Dockerfilewindows b/TestHosts/TestHosts/Dockerfilewindows index 7800dda..272c0e8 100644 --- a/TestHosts/TestHosts/Dockerfilewindows +++ b/TestHosts/TestHosts/Dockerfilewindows @@ -6,6 +6,8 @@ FROM mcr.microsoft.com/dotnet/sdk:10.0-windowsservercore-ltsc2022 AS build WORKDIR /src COPY ["TestHosts/TestHosts.csproj", "TestHosts/"] COPY ["TestHosts/NuGet.Config", "TestHosts/"] +COPY ["Directory.Packages.props", "."] +COPY . . RUN dotnet restore "TestHosts/TestHosts.csproj" COPY . . WORKDIR "/src/TestHosts"