From f738ead529788a4b67fa995d6c6cd31f67351641 Mon Sep 17 00:00:00 2001 From: Vincent Baaij Date: Tue, 18 Nov 2025 10:43:24 +0100 Subject: [PATCH] Fix Client projects in Web App templates --- .../BlazorWebCSharp.1.Client/Program.Main.cs | 7 +++++++ .../BlazorWebCSharp.1.Client/Program.cs | 7 +++++++ .../BlazorWebCSharp.1/Components/_Imports.razor | 2 -- .../blazorweb-csharp-8/.template.config/template.json | 1 + .../BlazorWeb-CSharp.Client/Program.Main.cs | 7 +++++++ .../blazorweb-csharp-8/BlazorWeb-CSharp.Client/Program.cs | 7 +++++++ .../BlazorWeb-CSharp.Client/Program.Main.cs | 7 +++++++ .../blazorweb-csharp-9/BlazorWeb-CSharp.Client/Program.cs | 7 +++++++ 8 files changed, 43 insertions(+), 2 deletions(-) diff --git a/src/Templates/templates/blazorweb-csharp-10/BlazorWebCSharp.1.Client/Program.Main.cs b/src/Templates/templates/blazorweb-csharp-10/BlazorWebCSharp.1.Client/Program.Main.cs index d0fec21b33..23c360f50b 100644 --- a/src/Templates/templates/blazorweb-csharp-10/BlazorWebCSharp.1.Client/Program.Main.cs +++ b/src/Templates/templates/blazorweb-csharp-10/BlazorWebCSharp.1.Client/Program.Main.cs @@ -1,4 +1,7 @@ using Microsoft.AspNetCore.Components.WebAssembly.Hosting; +#if (UseWebAssembly) +using Microsoft.FluentUI.AspNetCore.Components; +#endif namespace BlazorWebCSharp._1.Client; @@ -12,8 +15,12 @@ static async Task Main(string[] args) builder.Services.AddAuthorizationCore(); builder.Services.AddCascadingAuthenticationState(); builder.Services.AddAuthenticationStateDeserialization(); +#endif +#if (UseWebAssembly) + builder.Services.AddFluentUIComponents(); #endif + await builder.Build().RunAsync(); } } diff --git a/src/Templates/templates/blazorweb-csharp-10/BlazorWebCSharp.1.Client/Program.cs b/src/Templates/templates/blazorweb-csharp-10/BlazorWebCSharp.1.Client/Program.cs index 19becf2331..20ba830186 100644 --- a/src/Templates/templates/blazorweb-csharp-10/BlazorWebCSharp.1.Client/Program.cs +++ b/src/Templates/templates/blazorweb-csharp-10/BlazorWebCSharp.1.Client/Program.cs @@ -1,4 +1,7 @@ using Microsoft.AspNetCore.Components.WebAssembly.Hosting; +#if (UseWebAssembly) +using Microsoft.FluentUI.AspNetCore.Components; +#endif var builder = WebAssemblyHostBuilder.CreateDefault(args); @@ -6,6 +9,10 @@ builder.Services.AddAuthorizationCore(); builder.Services.AddCascadingAuthenticationState(); builder.Services.AddAuthenticationStateDeserialization(); +#endif +#if (UseWebAssembly) +builder.Services.AddFluentUIComponents(); #endif + await builder.Build().RunAsync(); diff --git a/src/Templates/templates/blazorweb-csharp-10/BlazorWebCSharp.1/Components/_Imports.razor b/src/Templates/templates/blazorweb-csharp-10/BlazorWebCSharp.1/Components/_Imports.razor index 0bd2906d71..8f10dde26d 100644 --- a/src/Templates/templates/blazorweb-csharp-10/BlazorWebCSharp.1/Components/_Imports.razor +++ b/src/Templates/templates/blazorweb-csharp-10/BlazorWebCSharp.1/Components/_Imports.razor @@ -14,8 +14,6 @@ @using BlazorWebCSharp._1 @*#if (UseWebAssembly) --> @using BlazorWebCSharp._1.Client -##endif*@ -@*#if (UseServer && UseWebAssembly && InteractiveAtRoot) --> @using BlazorWebCSharp._1.Client.Layout ##endif*@ @using BlazorWebCSharp._1.Components diff --git a/src/Templates/templates/blazorweb-csharp-8/.template.config/template.json b/src/Templates/templates/blazorweb-csharp-8/.template.config/template.json index 89f9317b09..830bc9c8dd 100644 --- a/src/Templates/templates/blazorweb-csharp-8/.template.config/template.json +++ b/src/Templates/templates/blazorweb-csharp-8/.template.config/template.json @@ -131,6 +131,7 @@ "exclude": [ "BlazorWeb-CSharp/Components/Account/**", "BlazorWeb-CSharp/Data/**", + "BlazorWeb-CSharp.Client/PersistentAuthenticationStateProvider.cs", "BlazorWeb-CSharp.Client/UserInfo.cs", "BlazorWeb-CSharp.Client/Pages/Auth.razor" ] diff --git a/src/Templates/templates/blazorweb-csharp-8/BlazorWeb-CSharp.Client/Program.Main.cs b/src/Templates/templates/blazorweb-csharp-8/BlazorWeb-CSharp.Client/Program.Main.cs index bc35c43451..77599f81ef 100644 --- a/src/Templates/templates/blazorweb-csharp-8/BlazorWeb-CSharp.Client/Program.Main.cs +++ b/src/Templates/templates/blazorweb-csharp-8/BlazorWeb-CSharp.Client/Program.Main.cs @@ -3,6 +3,9 @@ using Microsoft.AspNetCore.Components.Authorization; #endif using Microsoft.AspNetCore.Components.WebAssembly.Hosting; +#if (UseWebAssembly) +using Microsoft.FluentUI.AspNetCore.Components; +#endif namespace BlazorWeb_CSharp.Client; @@ -16,8 +19,12 @@ static async Task Main(string[] args) builder.Services.AddAuthorizationCore(); builder.Services.AddCascadingAuthenticationState(); builder.Services.AddSingleton(); +#endif +#if (UseWebAssembly) + builder.Services.AddFluentUIComponents(); #endif + await builder.Build().RunAsync(); } } diff --git a/src/Templates/templates/blazorweb-csharp-8/BlazorWeb-CSharp.Client/Program.cs b/src/Templates/templates/blazorweb-csharp-8/BlazorWeb-CSharp.Client/Program.cs index 600e37d365..24c150ef4c 100644 --- a/src/Templates/templates/blazorweb-csharp-8/BlazorWeb-CSharp.Client/Program.cs +++ b/src/Templates/templates/blazorweb-csharp-8/BlazorWeb-CSharp.Client/Program.cs @@ -3,6 +3,9 @@ using Microsoft.AspNetCore.Components.Authorization; #endif using Microsoft.AspNetCore.Components.WebAssembly.Hosting; +#if (UseWebAssembly) +using Microsoft.FluentUI.AspNetCore.Components; +#endif var builder = WebAssemblyHostBuilder.CreateDefault(args); @@ -10,6 +13,10 @@ builder.Services.AddAuthorizationCore(); builder.Services.AddCascadingAuthenticationState(); builder.Services.AddSingleton(); +#endif +#if (UseWebAssembly) +builder.Services.AddFluentUIComponents(); #endif + await builder.Build().RunAsync(); diff --git a/src/Templates/templates/blazorweb-csharp-9/BlazorWeb-CSharp.Client/Program.Main.cs b/src/Templates/templates/blazorweb-csharp-9/BlazorWeb-CSharp.Client/Program.Main.cs index 20605af0f7..29bbc1b83a 100644 --- a/src/Templates/templates/blazorweb-csharp-9/BlazorWeb-CSharp.Client/Program.Main.cs +++ b/src/Templates/templates/blazorweb-csharp-9/BlazorWeb-CSharp.Client/Program.Main.cs @@ -1,4 +1,7 @@ using Microsoft.AspNetCore.Components.WebAssembly.Hosting; +#if (UseWebAssembly) +using Microsoft.FluentUI.AspNetCore.Components; +#endif namespace BlazorWeb_CSharp.Client; @@ -12,8 +15,12 @@ static async Task Main(string[] args) builder.Services.AddAuthorizationCore(); builder.Services.AddCascadingAuthenticationState(); builder.Services.AddAuthenticationStateDeserialization(); +#endif +#if (UseWebAssembly) + builder.Services.AddFluentUIComponents(); #endif + await builder.Build().RunAsync(); } } diff --git a/src/Templates/templates/blazorweb-csharp-9/BlazorWeb-CSharp.Client/Program.cs b/src/Templates/templates/blazorweb-csharp-9/BlazorWeb-CSharp.Client/Program.cs index 19becf2331..20ba830186 100644 --- a/src/Templates/templates/blazorweb-csharp-9/BlazorWeb-CSharp.Client/Program.cs +++ b/src/Templates/templates/blazorweb-csharp-9/BlazorWeb-CSharp.Client/Program.cs @@ -1,4 +1,7 @@ using Microsoft.AspNetCore.Components.WebAssembly.Hosting; +#if (UseWebAssembly) +using Microsoft.FluentUI.AspNetCore.Components; +#endif var builder = WebAssemblyHostBuilder.CreateDefault(args); @@ -6,6 +9,10 @@ builder.Services.AddAuthorizationCore(); builder.Services.AddCascadingAuthenticationState(); builder.Services.AddAuthenticationStateDeserialization(); +#endif +#if (UseWebAssembly) +builder.Services.AddFluentUIComponents(); #endif + await builder.Build().RunAsync();