fix: v3 Library with Blazor Web App .NET 8
See original GitHub issue🐛 Bug Report
When using the library with the new Blazor Web App (.NET8 Preview 7) template, I’m not getting any of the styles loading like the Header, etc. The content is rendering, no errors in outputs/console log/etc. just not getting any UI that is expected.
💻 Repro or Code Sample
(install .NET 8 Preview 7)
- File…New Blazor Web App
- Add 3.0.0-RC1 package and configure project
- Add <Header> element to MainLayout
<FluentHeader>
My Dashboard
</FluentHeader>
🤔 Expected Behavior
Header renders like documentation indicates
😯 Current Behavior
Header content renders, but nothing else
Issue Analytics
- State:
- Created a month ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
ASP.NET Core updates in .NET 8 Preview 3
NET 8 Preview 3 is now available and includes many great new improvements to ASP.NET Core. Here's a summary of what's new in...
Read more >ASP.NET Core updates in .NET 8 Preview 6
In this preview release we've removed the Blazor Server template and the “ASP.NET Core hosted” option from the Blazor WebAssembly template. Both ...
Read more >Blazor WebAssembly 3.1 Target Framework is missing
A Blazor WebAssembly App, unlike Blazor Server App , runs under the Mono runtime. It is not .Net Core. Just add the project...
Read more >c# - Blazor the type or namespace name 'App' could not be ...
I have setup the basic application in Blazor in Microsoft Visual Studio Community 2019 Version 16.1.3 and I have tried both of the...
Read more >Blazor Hybrid Web Apps with .NET MAUI
NET MAUI. MAUI provides a set of technologies that enable apps to run on Web, desktop, and mobile. This new pattern is named...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@timheuer this how it works with .NET 8 at the moment (JS initializers behavior is not yet finalized, see also https://github.com/dotnet/aspnetcore/issues/50187)
By using the new template (which generates a SSR site) the module script (that loads the web components script and hooks up the custom events)) does not get called. Adding the web components script tag, as suggested by me before, only solves part of the problem.
I solved it in my copy of a site generated with the template as follows: 1 - Change
Program.csto add.AddServerComponents(), so fromto
2 - Add
@attribute [RenderModeServer]to the Index page directives to force it to be a Server component so library script (.lib.module.js) gets calledI guess adding
.AddWebAssemblyComponents();toProgram.csand@attribute [RenderModeWebAssembly]toIndex.razorwould have the same effect.The behavior has changed with . NET 8. I’m in contact with Mackinnon to see what would be a solution for this