asp.net core 8 MVC Identity Scaffold error using SqlServer, IdentityGeneratorTemplateModel2' does not contain a definition for 'UseSQLite'
- Dominant language
- C#
- Stars
- 818
- Forks
- 260
- Avg merge
- 1d 8h
- Merged PRs (30d)
- 10
Description
Seems pretty similair to issue #2257 but this is on .net 8
Identity Scaffolding fails with the error IdentityGeneratorTemplateModel2 does not contain a definition for 'UseSQLite' then the DBContext is in another project.
Clean generation of all files:
```
d:\projects\Project\Project.UI\dotnet aspnet-codegenerator identity -dc Project.Services.MyDbContext -gl -dbProvider sqlserver
Building project ...
Finding the generator 'identity'...
Running the generator 'identity'...
'Microsoft.VisualStudio.Web.CodeGenerators.Mvc.Identity.IdentityGeneratorTemplateModel2' does not contain a definition for 'UseSQLite'
at Microsoft.VisualStudio.Web.CodeGeneration.ActionInvoker.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:13.30
```
Projects structure/Folders:
- d:\projects\Project\Project.sln
- d:\projects\Project\Project.UI (asp.net mvc 8)
- d:\projects\Project\Project.Services
- Services\MyDbContext.cs
- Models\MyUseRModel.cs
Clean solution: It will a MyDbContext.cs file in Araes\Identity\Data and fail with the UseSQLite error
Clean solution: If i copy my original MyDbContext.cs file to Project.UI it will successfully generate the files (no errors)
Generated with above: If i then remove my MyDbContext.cs from the UI project and rerun the command with --force again it will succeed this time, but it will have created a Araes\Identity\Data\MyDbContext.cs again
dotnet 8
dotnet-aspnet-codegenerator 9.0.0
Microsoft.VisualStudio.Web.CodeGeneration.Design 9.0.0
```
.NET SDK:
Version: 9.0.201
Commit: 071aaccdc2
Workload version: 9.0.200-manifests.a3a1a094
MSBuild version: 17.13.13+1c2026462
Runtime Environment:
OS Name: Windows
OS Version: 10.0.26100
OS Platform: Windows
RID: win-x64
Base Path: C:\Program Files\dotnet\sdk\9.0.201\
.NET workloads installed:
[wasm-tools-net6]
Installation Source: VS 17.13.35828.75
Manifest Version: 9.0.3/9.0.100
Manifest Path: C:\Program Files\dotnet\sdk-manifests\9.0.100\microsoft.net.workload.mono.toolchain.net6\9.0.3\WorkloadManifest.json
Install Type: Msi
[wasm-tools-net7]
Installation Source: VS 17.13.35828.75
Manifest Version: 9.0.3/9.0.100
Manifest Path: C:\Program Files\dotnet\sdk-manifests\9.0.100\microsoft.net.workload.mono.toolchain.net7\9.0.3\WorkloadManifest.json
Install Type: Msi
[wasm-tools-net8]
Installation Source: VS 17.13.35828.75
Manifest Version: 9.0.3/9.0.100
Manifest Path: C:\Program Files\dotnet\sdk-manifests\9.0.100\microsoft.net.workload.mono.toolchain.net8\9.0.3\WorkloadManifest.json
Install Type: Msi
[aspire]
Installation Source: VS 17.13.35828.75
Manifest Version: 8.2.2/8.0.100
Manifest Path: C:\Program Files\dotnet\sdk-manifests\8.0.100\microsoft.net.sdk.aspire\8.2.2\WorkloadManifest.json
Install Type: Msi
[wasm-tools]
Installation Source: VS 17.13.35828.75
Manifest Version: 9.0.3/9.0.100
Manifest Path: C:\Program Files\dotnet\sdk-manifests\9.0.100\microsoft.net.workload.mono.toolchain.current\9.0.3\WorkloadManifest.json
Install Type: Msi
Configured to use loose manifests when installing new manifests.
Host:
Version: 9.0.3
Architecture: x64
Commit: 831d23e561
.NET SDKs installed:
8.0.312 [C:\Program Files\dotnet\sdk]
9.0.201 [C:\Program Files\dotnet\sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 8.0.14 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 8.0.16 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 9.0.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 8.0.14 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 8.0.16 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 9.0.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 8.0.14 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 8.0.16 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 9.0.3 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
```
Contributor guide
Assessment
This issue has not been assessed yet.