Skip to content

Modify the Blazor Web App template #53381

Closed
Closed

Description

Discussed in #52853

Originally posted by kevon-vems December 16, 2023
The default template for Blazor Web App contains boilerplate code, samples for Counter and Weather. We all know and love these. However, they're the first thing to go when using this template as a starting point for creating a real website.

The template uses the Counter to load additional assemblies. If you remove the Counter, it is not intuitive that you need to replace Counter with something else, and further not intuitive what that might be. If you alter the template to use the MainLayout instead, it would make removing the counter more straight forward, and generally make it so you would never need to change the AddAdditionalAssemblies(typeof(THING).Assembly) ever again.

If someone could point me at where the template lives, I'd happily create the PR myself.

Change

            app.MapRazorComponents<App>()
                .AddInteractiveServerRenderMode()
                .AddInteractiveWebAssemblyRenderMode()
                .AddAdditionalAssemblies(typeof(Counter).Assembly); 

to

            app.MapRazorComponents<App>()
                .AddInteractiveServerRenderMode()
                .AddInteractiveWebAssemblyRenderMode()
                .AddAdditionalAssemblies(typeof(MainLayout).Assembly); 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    Pillar: Dev ExperiencePriority:2Work that is important, but not critical for the releasearea-blazorIncludes: Blazor, Razor ComponentsenhancementThis issue represents an ask for new feature or an enhancement to an existing onefeature-templateshelp candidateIndicates that the issues may be a good fit for community to help with. Requires work from eng. team

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions