From 0eede88ab0bed4cf9fbeb537c2435786167acf36 Mon Sep 17 00:00:00 2001 From: Doug Waldron Date: Thu, 16 Jan 2025 12:46:11 -0500 Subject: [PATCH 1/2] Upgrade to .NET 9 and consolidate build settings See https://learn.microsoft.com/en-us/visualstudio/msbuild/customize-by-directory --- .github/workflows/sonarcloud-scan.yml | 10 ++--- .run/Run WebApp.run.xml | 4 +- .run/Watch WebApp.run.xml | 6 +-- .vscode/launch.json | 2 +- Directory.Build.props | 14 ++++++ global.json | 2 +- src/AppServices/AppServices.csproj | 9 ---- src/Domain/Domain.csproj | 9 ---- src/EfRepository/EfRepository.csproj | 9 ---- src/IaipDataService/IaipDataService.csproj | 9 ---- src/LocalRepository/LocalRepository.csproj | 9 ---- src/TestData/TestData.csproj | 12 ----- .../AppConfiguration/AppUrlRedirects.cs | 2 +- src/WebApp/WebApp.csproj | 9 ---- .../AppServicesTests/AppServicesTests.csproj | 33 -------------- tests/Directory.Build.props | 44 +++++++++++++++++++ tests/DomainTests/DomainTests.csproj | 33 -------------- .../EfRepositoryTests.csproj | 25 ----------- .../IaipDataServiceTests.csproj | 30 ------------- .../Identity/RoleStore.cs | 2 +- .../Identity/UserStore.cs | 2 +- .../LocalRepositoryTests.csproj | 33 -------------- tests/WebAppTests/WebAppTests.csproj | 33 -------------- 23 files changed, 73 insertions(+), 268 deletions(-) create mode 100644 tests/Directory.Build.props diff --git a/.github/workflows/sonarcloud-scan.yml b/.github/workflows/sonarcloud-scan.yml index a35d4d0f..e6effbbd 100644 --- a/.github/workflows/sonarcloud-scan.yml +++ b/.github/workflows/sonarcloud-scan.yml @@ -66,9 +66,9 @@ jobs: run: | .\.sonar\scanner\dotnet-sonarscanner begin /k:"gaepdit_air-web" /o:"gaepdit" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.opencover.reportsPaths=coverage.xml /d:sonar.exclusions=src/EfRepository/Migrations/**,src/TestData/** dotnet build - coverlet .\.artifacts\DomainTests\bin\Debug\net8.0\DomainTests.dll --target "dotnet" --targetargs "test tests/DomainTests --no-build" --exclude "[TestData]*" - coverlet .\.artifacts\EfRepositoryTests\bin\Debug\net8.0\EfRepositoryTests.dll --target "dotnet" --targetargs "test tests/EfRepositoryTests --no-build" --exclude "[TestData]*" --exclude "[EfRepository]AirWeb.EfRepository.Migrations.*" --merge-with "coverage.json" - coverlet .\.artifacts\LocalRepositoryTests\bin\Debug\net8.0\LocalRepositoryTests.dll --target "dotnet" --targetargs "test tests/LocalRepositoryTests --no-build" --exclude "[TestData]*" --merge-with "coverage.json" - coverlet .\.artifacts\AppServicesTests\bin\Debug\net8.0\AppServicesTests.dll --target "dotnet" --targetargs "test tests/AppServicesTests --no-build" --exclude "[TestData]*" --merge-with "coverage.json" - coverlet .\.artifacts\WebAppTests\bin\Debug\net8.0\WebAppTests.dll --target "dotnet" --targetargs "test tests/WebAppTests --no-build" --exclude "[TestData]*" --exclude "[EfRepository]AirWeb.EfRepository.Migrations.*" --merge-with "coverage.json" -f=opencover -o="coverage.xml" + coverlet .\.artifacts\DomainTests\bin\Debug\net9.0\DomainTests.dll --target "dotnet" --targetargs "test tests/DomainTests --no-build" --exclude "[TestData]*" + coverlet .\.artifacts\EfRepositoryTests\bin\Debug\net9.0\EfRepositoryTests.dll --target "dotnet" --targetargs "test tests/EfRepositoryTests --no-build" --exclude "[TestData]*" --exclude "[EfRepository]AirWeb.EfRepository.Migrations.*" --merge-with "coverage.json" + coverlet .\.artifacts\LocalRepositoryTests\bin\Debug\net9.0\LocalRepositoryTests.dll --target "dotnet" --targetargs "test tests/LocalRepositoryTests --no-build" --exclude "[TestData]*" --merge-with "coverage.json" + coverlet .\.artifacts\AppServicesTests\bin\Debug\net9.0\AppServicesTests.dll --target "dotnet" --targetargs "test tests/AppServicesTests --no-build" --exclude "[TestData]*" --merge-with "coverage.json" + coverlet .\.artifacts\WebAppTests\bin\Debug\net9.0\WebAppTests.dll --target "dotnet" --targetargs "test tests/WebAppTests --no-build" --exclude "[TestData]*" --exclude "[EfRepository]AirWeb.EfRepository.Migrations.*" --merge-with "coverage.json" -f=opencover -o="coverage.xml" .\.sonar\scanner\dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}" diff --git a/.run/Run WebApp.run.xml b/.run/Run WebApp.run.xml index fc849d6a..682f1165 100644 --- a/.run/Run WebApp.run.xml +++ b/.run/Run WebApp.run.xml @@ -1,7 +1,7 @@ - \ No newline at end of file + diff --git a/.run/Watch WebApp.run.xml b/.run/Watch WebApp.run.xml index 571ed45b..12557765 100644 --- a/.run/Watch WebApp.run.xml +++ b/.run/Watch WebApp.run.xml @@ -1,12 +1,12 @@ - - \ No newline at end of file + diff --git a/.vscode/launch.json b/.vscode/launch.json index d73ff05a..b46e1af2 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -7,7 +7,7 @@ "request": "launch", "preLaunchTask": "build", // If you have changed target frameworks, make sure to update the program path. - "program": "${workspaceFolder}/.artifacts/WebApp/bin/Debug/net8.0/WebApp.dll", + "program": "${workspaceFolder}/.artifacts/WebApp/bin/Debug/net9.0/WebApp.dll", "args": [], "cwd": "${workspaceFolder}/src/WebApp", "stopAtEntry": false, diff --git a/Directory.Build.props b/Directory.Build.props index d0aae1d7..695f0ca5 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,11 +1,25 @@ + + net9.0 + enable + enable + + $(MSBuildThisFileDirectory).artifacts\$(MSBuildProjectName) $(BaseProjectArtifactPath)\bin\ $(BaseProjectArtifactPath)\obj\ + true + + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + diff --git a/global.json b/global.json index 36394634..394a3922 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "8.0.0", + "version": "9.0.0", "rollForward": "latestFeature", "allowPrerelease": false } diff --git a/src/AppServices/AppServices.csproj b/src/AppServices/AppServices.csproj index ee453f6e..8198e2ef 100644 --- a/src/AppServices/AppServices.csproj +++ b/src/AppServices/AppServices.csproj @@ -1,9 +1,5 @@  - - net8.0 - enable - enable AirWeb.AppServices @@ -15,10 +11,6 @@ - - runtime; build; native; contentfiles; analyzers; buildtransitive - all - @@ -30,5 +22,4 @@ WorkEntryService.cs - diff --git a/src/Domain/Domain.csproj b/src/Domain/Domain.csproj index 877cc546..fae94056 100644 --- a/src/Domain/Domain.csproj +++ b/src/Domain/Domain.csproj @@ -1,9 +1,5 @@ - - net8.0 - enable - enable AirWeb.Domain @@ -12,10 +8,6 @@ - - runtime; build; native; contentfiles; analyzers; buildtransitive - all - @@ -30,5 +22,4 @@ AppRole.cs - diff --git a/src/EfRepository/EfRepository.csproj b/src/EfRepository/EfRepository.csproj index 656b7b6f..a0fa3ade 100644 --- a/src/EfRepository/EfRepository.csproj +++ b/src/EfRepository/EfRepository.csproj @@ -1,9 +1,5 @@ - - net8.0 - enable - enable AirWeb.EfRepository @@ -15,10 +11,6 @@ all - - runtime; build; native; contentfiles; analyzers; buildtransitive - all - @@ -29,5 +21,4 @@ - diff --git a/src/IaipDataService/IaipDataService.csproj b/src/IaipDataService/IaipDataService.csproj index e4d237f0..503fa44e 100644 --- a/src/IaipDataService/IaipDataService.csproj +++ b/src/IaipDataService/IaipDataService.csproj @@ -1,9 +1,5 @@  - - net8.0 - enable - enable IaipDataService @@ -13,10 +9,5 @@ - - runtime; build; native; contentfiles; analyzers; buildtransitive - all - - diff --git a/src/LocalRepository/LocalRepository.csproj b/src/LocalRepository/LocalRepository.csproj index 8fb73be6..f3fc505f 100644 --- a/src/LocalRepository/LocalRepository.csproj +++ b/src/LocalRepository/LocalRepository.csproj @@ -1,23 +1,14 @@ - - net8.0 - enable - enable AirWeb.LocalRepository - - runtime; build; native; contentfiles; analyzers; buildtransitive - all - - diff --git a/src/TestData/TestData.csproj b/src/TestData/TestData.csproj index 1c913628..335ec4a6 100644 --- a/src/TestData/TestData.csproj +++ b/src/TestData/TestData.csproj @@ -1,21 +1,9 @@ - - net8.0 - enable - enable AirWeb.TestData - - - runtime; build; native; contentfiles; analyzers; buildtransitive - all - - - - diff --git a/src/WebApp/Platform/AppConfiguration/AppUrlRedirects.cs b/src/WebApp/Platform/AppConfiguration/AppUrlRedirects.cs index 6f862bc0..9c6a3c7f 100644 --- a/src/WebApp/Platform/AppConfiguration/AppUrlRedirects.cs +++ b/src/WebApp/Platform/AppConfiguration/AppUrlRedirects.cs @@ -4,7 +4,7 @@ namespace AirWeb.WebApp.Platform.AppConfiguration; // URL Rewriting Middleware in ASP.NET Core -// https://learn.microsoft.com/en-us/aspnet/core/fundamentals/url-rewriting?view=aspnetcore-8.0#performance-tips-for-url-rewrite-and-redirect +// https://learn.microsoft.com/en-us/aspnet/core/fundamentals/url-rewriting#performance-tips-for-url-rewrite-and-redirect public static class AppUrlRedirects { // language=regex diff --git a/src/WebApp/WebApp.csproj b/src/WebApp/WebApp.csproj index 97dc63bd..fe9abb76 100644 --- a/src/WebApp/WebApp.csproj +++ b/src/WebApp/WebApp.csproj @@ -1,10 +1,6 @@ - 2024.8.27 - net8.0 - enable - enable AirWeb.WebApp @@ -15,10 +11,6 @@ - - runtime; build; native; contentfiles; analyzers; buildtransitive - all - @@ -60,5 +52,4 @@ web.config - diff --git a/tests/AppServicesTests/AppServicesTests.csproj b/tests/AppServicesTests/AppServicesTests.csproj index f35b380d..6b0c5dec 100644 --- a/tests/AppServicesTests/AppServicesTests.csproj +++ b/tests/AppServicesTests/AppServicesTests.csproj @@ -1,39 +1,6 @@  - - - net8.0 - enable - enable - false - - - - - - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - runtime; build; native; contentfiles; analyzers; buildtransitive - all - - - - diff --git a/tests/Directory.Build.props b/tests/Directory.Build.props new file mode 100644 index 00000000..9df08d4c --- /dev/null +++ b/tests/Directory.Build.props @@ -0,0 +1,44 @@ + + + net9.0 + enable + enable + false + true + + + + $(MSBuildThisFileDirectory)..\.artifacts\$(MSBuildProjectName) + $(BaseProjectArtifactPath)\bin\ + $(BaseProjectArtifactPath)\obj\ + + + + + true + + + + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + diff --git a/tests/DomainTests/DomainTests.csproj b/tests/DomainTests/DomainTests.csproj index bc3e9ddb..85d50dd5 100644 --- a/tests/DomainTests/DomainTests.csproj +++ b/tests/DomainTests/DomainTests.csproj @@ -1,39 +1,6 @@ - - - net8.0 - enable - enable - false - - - - - - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - runtime; build; native; contentfiles; analyzers; buildtransitive - all - - - - diff --git a/tests/EfRepositoryTests/EfRepositoryTests.csproj b/tests/EfRepositoryTests/EfRepositoryTests.csproj index 619dc60b..5871c5d3 100644 --- a/tests/EfRepositoryTests/EfRepositoryTests.csproj +++ b/tests/EfRepositoryTests/EfRepositoryTests.csproj @@ -1,30 +1,6 @@ - - - net8.0 - enable - enable - false - - - - - - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - runtime; build; native; contentfiles; analyzers; buildtransitive - all - @@ -37,5 +13,4 @@ - diff --git a/tests/IaipDataServiceTests/IaipDataServiceTests.csproj b/tests/IaipDataServiceTests/IaipDataServiceTests.csproj index f938135f..77583147 100644 --- a/tests/IaipDataServiceTests/IaipDataServiceTests.csproj +++ b/tests/IaipDataServiceTests/IaipDataServiceTests.csproj @@ -1,35 +1,5 @@ - - - net8.0 - enable - enable - - false - true - - - - - - - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - runtime; build; native; contentfiles; analyzers; buildtransitive - all - - - - diff --git a/tests/LocalRepositoryTests/Identity/RoleStore.cs b/tests/LocalRepositoryTests/Identity/RoleStore.cs index 2eb9f0ce..d9ad8b9f 100644 --- a/tests/LocalRepositoryTests/Identity/RoleStore.cs +++ b/tests/LocalRepositoryTests/Identity/RoleStore.cs @@ -49,7 +49,7 @@ public async Task FindById_ReturnsRole() public async Task FindByName_ReturnsRole() { var role = _store.Roles.First(); - Debug.Assert(role.NormalizedName != null, "role.NormalizedName != null"); + Debug.Assert(role.NormalizedName != null); var result = await _store.FindByNameAsync(role.NormalizedName, CancellationToken.None); result.Should().BeEquivalentTo(role); } diff --git a/tests/LocalRepositoryTests/Identity/UserStore.cs b/tests/LocalRepositoryTests/Identity/UserStore.cs index 9d984f71..26e3ef03 100644 --- a/tests/LocalRepositoryTests/Identity/UserStore.cs +++ b/tests/LocalRepositoryTests/Identity/UserStore.cs @@ -78,7 +78,7 @@ public async Task FindById_ReturnsUser() public async Task FindByName_ReturnsUser() { var user = _store.UserStore.First(); - Debug.Assert(user.NormalizedUserName != null, "role.NormalizedName != null"); + Debug.Assert(user.NormalizedUserName != null); var result = await _store.FindByNameAsync(user.NormalizedUserName, CancellationToken.None); result.Should().BeEquivalentTo(user); } diff --git a/tests/LocalRepositoryTests/LocalRepositoryTests.csproj b/tests/LocalRepositoryTests/LocalRepositoryTests.csproj index 9bf85e9d..eaed25d3 100644 --- a/tests/LocalRepositoryTests/LocalRepositoryTests.csproj +++ b/tests/LocalRepositoryTests/LocalRepositoryTests.csproj @@ -1,38 +1,5 @@  - - - net8.0 - enable - enable - false - - - - - - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - runtime; build; native; contentfiles; analyzers; buildtransitive - all - - - - diff --git a/tests/WebAppTests/WebAppTests.csproj b/tests/WebAppTests/WebAppTests.csproj index adf73b15..839a13f5 100644 --- a/tests/WebAppTests/WebAppTests.csproj +++ b/tests/WebAppTests/WebAppTests.csproj @@ -1,38 +1,5 @@ - - - net8.0 - enable - enable - false - - - - - - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - runtime; build; native; contentfiles; analyzers; buildtransitive - all - - - - From 9356cd15897b62799237ed748c6357cdbdf33881 Mon Sep 17 00:00:00 2001 From: Doug Waldron Date: Thu, 16 Jan 2025 15:20:29 -0500 Subject: [PATCH 2/2] Update all NuGet packages --- Directory.Packages.props | 73 +++++++++++++++------------------------- 1 file changed, 28 insertions(+), 45 deletions(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index 277171fe..9b5fd6bb 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -4,58 +4,41 @@ - + + + - + - - + + - - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - + + + + + + + - - + + - + + - - + + + + + + + - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - + + + - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - \ No newline at end of file +