question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Scaffolded Identity "Manage" Layout Refers to Unscaffoldable Layout Page

See original GitHub issue

From @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

  1. In VS2019, create a new ASP.Net Core web application using “Individual User Accounts” authentication
  2. Right-click project node in Solution Explorer, select Add | New Scaffolded Item…
  3. Use the scaffolder to add the Identity page Areas\Identity\Pages\Account\Manage_Layout.cshtml to the project
  4. 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:open
  • Created 4 years ago
  • Reactions:1
  • Comments:15 (13 by maintainers)

github_iconTop GitHub Comments

3reactions
AndrewTriesToCodecommented, Jan 27, 2022

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.

0reactions
javiercncommented, Jun 10, 2020

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Scaffold Identity in ASP.NET Core projects
Select Identity in the center pane. Select the Add button. In the Add Identity dialog, select the options you want. If you have...
Read more >
Confused by Layout files when scaffolding identity in ...
I've now decided I need to customise the identity UI pages, so I've scaffolded all the pages and I'm confused on what the...
Read more >
Cannot find Identity's Layout.cshtml file even after ...
I am using Asp.net core and I have scaffolded all the identity pages , it created a folder in my root directory named...
Read more >
ASP.NET Core 2.2 - Scaffold Identity UI
This article will cover just scaffolding Identity UI and provide solutions to a couple of layout issues. I will assume you have created...
Read more >
Scaffolding in Razor Pages
Scaffolding in ASP.NET Core is a technique used to generate code at design time to support a number of common application scenarios when ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found