Alexander Zeitler

IdentityGeneratorTemplateMode2 does not contain a definition for "UseSQLite"

Published on Saturday, March 18, 2023

The other day I tried to scaffold ASP.NET Identity for Sqlite (actually I wanted to scaffold it for Postgres but that's another story) from the CLI:

dotnet aspnet-codegenerator identity -dc IdentityDbContext -u AppUser -f -gl -dbProvider sqlite

Straight forward, but I got this error:

IdentityGeneratorTemplateMode2 does not contain a definition for 'UseSQLite'.

The project I was trying to add Identity to, has been a spike where I was trying out some stuff using Alba.

One thing I had changed in the project compared to others where I was scaffolding Identity successfully, was that the project contained a Startup.cs file.

As I was stuck I just tried guessing and deleted the Startup.cs file and ran the scaffolding again.

And boom 💥, it did work successfully again.

Right now I don't know why the file caused this issue but I provided my learning to an existing GitHub issue so Microsoft can figure it out.

Update

Make sure to read the follow up.

Twitter preview Photo by Jackson Simmer on Unsplash
What are your thoughts about
"IdentityGeneratorTemplateMode2 does not contain a definition for "UseSQLite""?
Drop me a line - I'm looking forward to your feedback!
Please be aware that I'm no longer active on social media. I'm just cross posting things over there (it's a bot).
Imprint | Privacy