From adb4d4101e308541f386cd049fcaa731345b3013 Mon Sep 17 00:00:00 2001 From: Vladimir Pecanac Date: Mon, 14 Sep 2026 15:52:11 +0200 Subject: [PATCH] MapControllers vs MapControllerRoute: retarget to net10.0, refresh test stack - Both projects move from net8.0 to net10.0. - Test packages: Microsoft.AspNetCore.Mvc.Testing 10.0.12, Microsoft.NET.Test.Sdk 18.10.0, xunit 2.9.3, xunit.runner.visualstudio 4.0.0, coverlet.collector 10.0.1. - Remove the no-op from Tests.csproj: it named the test project itself, and both tests drive the app through WebApplicationFactory and HTTP. - Remove seven leftover _ContentIncludedByDefault Remove= entries naming view files that no longer exist in the folder. - Null-conditional on ContentType in ConventionIntegrationTest, which fixes the CS8602 the retarget surfaces under enable. Build clean with 0 warnings, 9 of 9 tests pass on SDK 10.0.302 / runtime 10.0.10. --- .../MapControllersVsMapControllerRoute.csproj | 12 +----------- .../Tests/ConventionIntegrationTest.cs | 2 +- .../Tests/Tests.csproj | 16 ++++++---------- 3 files changed, 8 insertions(+), 22 deletions(-) diff --git a/aspnetcore-features/MapControllersMapControllerRouteSln/MapControllersVsMapControllerRoute/MapControllersVsMapControllerRoute.csproj b/aspnetcore-features/MapControllersMapControllerRouteSln/MapControllersVsMapControllerRoute/MapControllersVsMapControllerRoute.csproj index b0e49d6f5e..9c54a73a08 100644 --- a/aspnetcore-features/MapControllersMapControllerRouteSln/MapControllersVsMapControllerRoute/MapControllersVsMapControllerRoute.csproj +++ b/aspnetcore-features/MapControllersMapControllerRouteSln/MapControllersVsMapControllerRoute/MapControllersVsMapControllerRoute.csproj @@ -1,21 +1,11 @@ - net8.0 + net10.0 enable enable - - <_ContentIncludedByDefault Remove="Views\Customers\Detail.cshtml" /> - <_ContentIncludedByDefault Remove="Views\Customers\Index.cshtml" /> - <_ContentIncludedByDefault Remove="Views\Customers\Order.cshtml" /> - <_ContentIncludedByDefault Remove="Views\Customers\SpecialRoute.cshtml" /> - <_ContentIncludedByDefault Remove="Views\Shared\Error.cshtml" /> - <_ContentIncludedByDefault Remove="Views\Shared\_Layout.cshtml" /> - <_ContentIncludedByDefault Remove="Views\Shared\_ValidationScriptsPartial.cshtml" /> - - diff --git a/aspnetcore-features/MapControllersMapControllerRouteSln/Tests/ConventionIntegrationTest.cs b/aspnetcore-features/MapControllersMapControllerRouteSln/Tests/ConventionIntegrationTest.cs index 38a855db3e..625fb9f43e 100644 --- a/aspnetcore-features/MapControllersMapControllerRouteSln/Tests/ConventionIntegrationTest.cs +++ b/aspnetcore-features/MapControllersMapControllerRouteSln/Tests/ConventionIntegrationTest.cs @@ -23,6 +23,6 @@ public async Task WhenMapControllerRouteRun_ThenSuccess(string url) response.EnsureSuccessStatusCode(); // Status Code 200-299 Assert.Equal("text/html; charset=utf-8", - response.Content.Headers.ContentType.ToString()); + response.Content.Headers.ContentType?.ToString()); } } \ No newline at end of file diff --git a/aspnetcore-features/MapControllersMapControllerRouteSln/Tests/Tests.csproj b/aspnetcore-features/MapControllersMapControllerRouteSln/Tests/Tests.csproj index 0f168d00d5..147bc95042 100644 --- a/aspnetcore-features/MapControllersMapControllerRouteSln/Tests/Tests.csproj +++ b/aspnetcore-features/MapControllersMapControllerRouteSln/Tests/Tests.csproj @@ -1,7 +1,7 @@ - net8.0 + net10.0 enable enable @@ -10,23 +10,19 @@ - - - - + + + + runtime; build; native; contentfiles; analyzers; buildtransitive all - + runtime; build; native; contentfiles; analyzers; buildtransitive all - - - -