Scaffolded Identity "Manage" Layout Refers to Unscaffoldable Layout Page
See original GitHub issueFrom @pm64 on Wednesday, January 8, 2020 7:04:03 PM
Describe the bug
The scaffolded Areas\Identity\Pages\Account\Manage\_Layout.cshtml page references “/Areas/Identity/Pages/_Layout.cshtml” as its layout. This page is not present in the project template and is not available for scaffolding.
To Reproduce
- In VS2019, create a new ASP.Net Core web application using “Individual User Accounts” authentication
- Right-click project node in Solution Explorer, select Add | New Scaffolded Item…
- Use the scaffolder to add the Identity page Areas\Identity\Pages\Account\Manage_Layout.cshtml to the project
- Observe that the generated _Layout.cshtml references “/Areas/Identity/Pages/_Layout.cshtml” as its layout. This page does not exist in the project template and is not itself available for scaffolding.
Notes
- A workaround is to change the layout to “/Pages/Shared/_Layout.cshtml”, a page that does reside in the project template. But I don’t believe this is the intended layout (though it may be very similar), since “Areas\Identity\Pages\Account\Manage_Layout.cshtml” does get rendered at runtime. The intended layout appears to be imprisoned in the Identity DLL.
Further technical details
- ASP.NET Core version 3.1
- Output of
dotnet --info
: .NET Core SDK (reflecting any global.json): Version: 3.1.100 Commit: cd82f021f4
Runtime Environment: OS Name: Windows OS Version: 10.0.18363 OS Platform: Windows RID: win10-x64 Base Path: C:\Program Files\dotnet\sdk\3.1.100\
Host (useful for support): Version: 3.1.0 Commit: 65f04fb6db
.NET Core SDKs installed: 3.1.100 [C:\Program Files\dotnet\sdk]
.NET Core runtimes installed: Microsoft.AspNetCore.All 2.1.14 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.All 2.2.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.App 2.1.14 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 2.2.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 3.1.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 2.1.14 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.2.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 3.1.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.WindowsDesktop.App 3.1.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
To install additional .NET Core runtimes or SDKs: https://aka.ms/dotnet-download
- The IDE (VS / VS Code/ VS4Mac) you’re running on, and it’s version: Visual Studio Enterprise 2019 v16.4.2
Copied from original issue: dotnet/aspnetcore#18200
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:15 (13 by maintainers)
Top GitHub Comments
FYI for anyone following along this issue seems to be resolved now. I noticed in August a file was added which explicity sets the parent view so that the bad path is not used. /Areas/Identity/Pages/Account/Manage/_ViewStart.cshtml
What’s interesting is that this file doesn’t get scaffolded so I spent a little while scratching my head on where
ParentLayout
was set until I checked the source on GitHub.The code is correct, we try to find the layout on the Area if there is no layout on the app, but use the layout on the app if present. SPA templates for example don’t have a layout on the app and everything is self-contained within the Identity area. Blazor is a similar deal.