dotnet / dotnet/AspNetCore.Docs
Asp.net 6 scaffold identity generates additional connection string and register dbcontext and identity twice
- Dominant language
- C#
- Stars
- 13.1k
- Forks
- 24.6k
- Avg merge
- 1d 3h
- Merged PRs (30d)
- 97
Description
I create ASP.NET Core Web App with individual user accounts, Then i scaffold identity, Here i select Register, Login, LogOut, and RegisterConfirmation, Then i select ApplicationDbContext as Data Context Class and click add.

The problem is that in program.cs it generates additional connection string (so there are two of them), as well as dublicates of builder.Services.AddDbContext... and builder.Services.AddDefaultIdentity...

I try this steps in asp.net core 3.1 and it will not show the same situation as .net 6
The version of my VS is Visual Studio Community 2022 (17.1.6).
---
#### Document Details
⚠ *Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.*
* ID: 804e24dd-7e30-8cf5-2c99-1ffacb4582f6
* Version Independent ID: 3e25547b-e2c9-6634-2c38-2a77207f17d4
* Content: [Scaffold Identity in ASP.NET Core projects](https://docs.microsoft.com/en-us/aspnet/core/security/authentication/scaffold-identity?view=aspnetcore-6.0&tabs=visual-studio)
* Content Source: [aspnetcore/security/authentication/scaffold-identity.md](https://github.com/dotnet/AspNetCore.Docs/blob/main/aspnetcore/security/authentication/scaffold-identity.md)
* Product: **aspnet-core**
* Technology: **aspnetcore-security**
* GitHub Login: @Rick-Anderson
* Microsoft Alias: **riande**
Contributor guide
Assessment
This issue has not been assessed yet.