© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•2y ago•
1 reply
Tiltyboi

EF-Core migrations issue

I have split a large project into multiple places. I have 1 class-library with my classes and contexts, 1 class library where my migrations will go and then my main app.
When i do
Add-Migration init -Project <lib-with-context>
Add-Migration init -Project <lib-with-context>
it throws this lovely error:

Unable to create a 'DbContext' of type ''. The exception 'Unable to resolve service for type 'Microsoft.EntityFrameworkCore.DbContextOptions`1[SadBot.Core.Database.RPGContext]' while attempting to activate 'SadBot.Core.Database.RPGContext'.' was thrown while attempting to create an instance. For the different patterns supported at design time, see https://go.microsoft.com/fwlink/?linkid=851728
Unable to create a 'DbContext' of type ''. The exception 'Unable to resolve service for type 'Microsoft.EntityFrameworkCore.DbContextOptions`1[SadBot.Core.Database.RPGContext]' while attempting to activate 'SadBot.Core.Database.RPGContext'.' was thrown while attempting to create an instance. For the different patterns supported at design time, see https://go.microsoft.com/fwlink/?linkid=851728
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

❔ EF Core migrations
C#CC# / help
4y ago
✅ EF Core migrations with Docker
C#CC# / help
11mo ago
EF Core not creating migrations
C#CC# / help
14mo ago
Migrating to EF Core migrations
C#CC# / help
17mo ago