dotnet / dotnet/aspnetcore

Blazor Web App template: The `Layout` folder (namespace) isn't present in the `_Imports` file

Open
#52,478 2 comments 2 reactions 1 assignee Assigned to @Copilot View on GitHub
area-blazor bug copilot-candidate feature-templates Priority:2
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 6h
Merged PRs (30d)
290

Description

### Is there an existing issue for this?

- [X] I have searched the existing issues

### Is your feature request related to a problem? Please describe the problem.

In prior releases (Blazor Server), the `Shared` folder namespace was placed in the `_Imports` file. This release for BWAs, only the `Components` folder is present. This results in the incongruous situation where "`Layout.`" has to be supplied on `DefaultLayout` ...

```razor

```

... which wasn't required before and still isn't required for Blazor WebAssembly apps. It's [breaking the docs](https://github.com/dotnet/AspNetCore.Docs/issues/31170) and requiring further versioned content.

### Describe the solution you'd like

Consider adding it to the `_Imports` file ...

```razor
@using BlazorWeb_CSharp.Components.Layout
```

Remove "`Layout.`" from the two `DefaultLayout` params in `Routes.razor`.

### Additional context

***BTW*** .... It seems like if the components folder is plural (`Components`) and the routable components folder is plural (`Pages`) that the layout folder name should also be plural (`Layouts`).

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.