Skip to content

Blazor .NET 9 template generates App.razor with full HTML structure instead of only Blazor components #62189

Closed
@ProgramandoIdeas1

Description

@ProgramandoIdeas1

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

Descripción:
When creating a new Blazor project targeting .NET 9, the generated App.razor file contains the entire HTML document structure (, , , , etc.) instead of only Blazor components like , , and .

Expected Behavior

Expected behavior:
According to Blazor best practices and documentation, the HTML structure should be in wwwroot/index.html (for Blazor WebAssembly) or in _Layout.cshtml (for Blazor Server).
App.razor should only contain Blazor components, for example:

Actual behavior:
The template generates App.razor like this:

... <script src="_framework/blazor.web.js"></script>

Impact:
• and do not work as expected.
• The project does not follow the recommended Blazor structure.
• This can confuse developers and break dynamic head updates.
Steps to reproduce:

  1. Create a new Blazor project targeting .NET 9.
  2. Open the generated App.razor file.
  3. Observe that it contains the full HTML structure.
    Environment:
    • .NET 9
    • Visual Studio 2022 (or specify your IDE)
    • Blazor (WebAssembly or Server, specify which)

Steps To Reproduce

No response

Exceptions (if any)

No response

.NET Version

No response

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions