Skip to content

Apply layout from _Imports.razor to a folder and its subfolders is not working #35068

Closed
@TanvirArjel

Description

@TanvirArjel

ASP.NET Core Blazor layouts documentation said that:

Every folder of an app can optionally contain a template file named _Imports.razor. The compiler includes the directives specified in the imports file in all of the Razor templates in the same folder and recursively in all of its subfolders. Therefore, an _Imports.razor file containing @layout DoctorWhoLayout ensures that all of the components in a folder use the DoctorWhoLayout component. There's no need to repeatedly add @layout DoctorWhoLayout to all of the Razor components (.razor) within the folder and subfolders.

But is not working for the following admin folder and its subfolder. If I move the _Imports.razor file inside Admin/Pages folder then it works for the Components inside Admin/Pages folder.

Untitled

Even not working for the following folder structure:

tempsnip

If I go to the route of the components inside Admin folder and its subfolder, the application freezes, and no error is thrown in the console.

Metadata

Metadata

Assignees

No one assigned

    Labels

    ✔️ Resolution: AnsweredResolved because the question asked by the original author has been answered.Status: Resolvedarea-blazorIncludes: Blazor, Razor Components

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions