From 091cf216b90f2390e3f2fa3a2ef62ba4a7d40954 Mon Sep 17 00:00:00 2001 From: Charley Wu Date: Thu, 14 Nov 2024 22:25:32 +0800 Subject: [PATCH] Migrate from ASP.NET Core in .NET 8 to ASP.NET Core in .NET 9 - https://learn.microsoft.com/aspnet/core/migration/80-90 --- samples/AspNetCoreIdentitySample/Program.cs | 4 ++-- samples/AspNetCoreReactSample/Program.cs | 4 ++-- samples/AspNetCoreSample/Program.cs | 4 ++-- samples/BlazorSample/Components/App.razor | 6 +++--- samples/BlazorSample/Components/Layout/MainLayout.razor | 2 +- samples/BlazorSample/Components/Layout/MainLayout.razor.css | 0 samples/BlazorSample/Program.cs | 4 ++-- 7 files changed, 12 insertions(+), 12 deletions(-) create mode 100644 samples/BlazorSample/Components/Layout/MainLayout.razor.css diff --git a/samples/AspNetCoreIdentitySample/Program.cs b/samples/AspNetCoreIdentitySample/Program.cs index 369ffeae..895184c0 100644 --- a/samples/AspNetCoreIdentitySample/Program.cs +++ b/samples/AspNetCoreIdentitySample/Program.cs @@ -83,13 +83,13 @@ } app.UseHttpsRedirection(); -app.UseStaticFiles(); +app.MapStaticAssets(); app.UseRouting(); app.UseAuthentication(); app.UseAuthorization(); -app.MapRazorPages(); +app.MapRazorPages().WithStaticAssets(); app.Run(); \ No newline at end of file diff --git a/samples/AspNetCoreReactSample/Program.cs b/samples/AspNetCoreReactSample/Program.cs index 90579f97..59018d30 100644 --- a/samples/AspNetCoreReactSample/Program.cs +++ b/samples/AspNetCoreReactSample/Program.cs @@ -77,14 +77,14 @@ // Configure the HTTP request pipeline. app.UseHttpsRedirection(); -app.UseStaticFiles(); +app.MapStaticAssets(); app.UseRouting(); app.UseAuthentication(); app.UseAuthorization(); -app.MapControllers(); +app.MapControllers().WithStaticAssets(); app.MapFallbackToFile("index.html").AllowAnonymous(); app.Run(); \ No newline at end of file diff --git a/samples/AspNetCoreSample/Program.cs b/samples/AspNetCoreSample/Program.cs index f4925e57..76369519 100644 --- a/samples/AspNetCoreSample/Program.cs +++ b/samples/AspNetCoreSample/Program.cs @@ -173,7 +173,7 @@ } app.UseHttpsRedirection(); -app.UseStaticFiles(); +app.MapStaticAssets(); app.UseRouting(); @@ -185,6 +185,6 @@ app.UseAuthentication(); app.UseAuthorization(); -app.MapRazorPages(); +app.MapRazorPages().WithStaticAssets(); app.Run(); diff --git a/samples/BlazorSample/Components/App.razor b/samples/BlazorSample/Components/App.razor index 61e7835c..0898409e 100644 --- a/samples/BlazorSample/Components/App.razor +++ b/samples/BlazorSample/Components/App.razor @@ -6,14 +6,14 @@ - - + + - + diff --git a/samples/BlazorSample/Components/Layout/MainLayout.razor b/samples/BlazorSample/Components/Layout/MainLayout.razor index a63828e8..b06e71ef 100644 --- a/samples/BlazorSample/Components/Layout/MainLayout.razor +++ b/samples/BlazorSample/Components/Layout/MainLayout.razor @@ -10,6 +10,6 @@
An unhandled error has occurred. - Reload + Reload 🗙
\ No newline at end of file diff --git a/samples/BlazorSample/Components/Layout/MainLayout.razor.css b/samples/BlazorSample/Components/Layout/MainLayout.razor.css new file mode 100644 index 00000000..e69de29b diff --git a/samples/BlazorSample/Program.cs b/samples/BlazorSample/Program.cs index cea8a449..1480d9f5 100644 --- a/samples/BlazorSample/Program.cs +++ b/samples/BlazorSample/Program.cs @@ -85,7 +85,7 @@ } app.UseHttpsRedirection(); -app.UseStaticFiles(); +app.MapStaticAssets(); app.UseRouting(); @@ -94,7 +94,7 @@ app.UseAntiforgery(); -app.MapRazorPages(); +app.MapRazorPages().WithStaticAssets(); app.MapRazorComponents() .AddInteractiveServerRenderMode();