Missing "IdentityHostingStartup.cshtml" when scaffolding Identity
See original GitHub issueIssue
Identity scaffolding fails with the following error when run by either command line (as below, for any combination of files) or via the IDE context menu (Add -> New Scaffolded Item… -> Identity).
> dotnet aspnet-codegenerator identity -dc MyProject.Data.MyContext --files "Account.Login;Account.Logout"
Building project ...
Finding the generator 'identity'...
Running the generator 'identity'...
A file matching the name IdentityHostingStartup.cshtml was not found within any of the folders: C:\Users\Extragorey\.nuget\packages\Microsoft.VisualStudio.Web.CodeGenerators.Mvc\6.0.0\Templates\Identity\Data;C:\Users\Extragorey\.nuget\packages\Microsoft.VisualStudio.Web.CodeGenerators.Mvc\6.0.0\Templates\Identity\Pages;C:\Users\Extragorey\.nuget\packages\Microsoft.VisualStudio.Web.CodeGenerators.Mvc\6.0.0\Templates\Identity
at Microsoft.VisualStudio.Web.CodeGeneration.ActionInvoker.<BuildCommandLine>b__6_0()
at Microsoft.Extensions.CommandLineUtils.CommandLineApplication.Execute(String[] args)
at Microsoft.VisualStudio.Web.CodeGeneration.ActionInvoker.Execute(String[] args)
at Microsoft.VisualStudio.Web.CodeGeneration.CodeGenCommand.Execute(String[] args)
RunTime 00:00:07.76
Solution
Manually add IdentityHostingStartup.cshtml to the folder specified (….nuget\packages\Microsoft.VisualStudio.Web.CodeGenerators.Mvc\6.0.0\Templates\Identity), copying it from this source. Once added, scaffolding works as expected.
Suggested: Include IdentityHostingStartup.cshtml in the Microsoft.VisualStudio.Web.CodeGenerators.Mvc
nuget package distribution.
Environment Info
Libraries: twitter-bootstrap@5.1.3 Target framework: .NET 6.0 IDE: Visual Studio 2022 17.0.1 Operating system: Windows Server 2016 Standard
Issue Analytics
- State:
- Created 2 years ago
- Reactions:29
- Comments:10 (2 by maintainers)
Top Results From Across the Web
Scaffold Identity in ASP.NET Core projects
From the left pane of the Add New Scaffolded Item dialog, select Identity. Select Identity in the center pane. Select the Add button....
Read more >Layout for Identity/Account/Manage pages broken after ...
The side menu is missing. The app is no longer finding Areas/Identity/Pages/Account/Manage/_Layout.cshtml , and I don't understand why.
Read more >Implement Identity On Existing ASP.NET Project
Tutorial step-by-step to add Identity to an existing ASP.NET project. Scaffold the required pages and customize them with your code.
Read more >Blazor Server Project #12: Installing ASP.NET Core Identity
An initial guide to security: installing Identity and adding its database to ... Missing "IdentityHostingStartup.cshtml" when scaffolding Identity · Issue ...
Read more >Customising the ASP.NET Core default UI without editing ...
In this post I show how you can replace the Razor views for the ASP.NET Core Identity default UI, without having to replace...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Finally! Worked for me!
@Extragorey Hey, tracking this issue for the next update. Will update here when it goes out.