Migration Error
Hello, I created migration by this code ( dotnet ef migrations add firstmigration ) and I had to delete it for some reasons I just deleted Migrations folder from Visual Studio and when I am trying to recreate migration from cmd with same code ( dotnet ef migrations add firstmigration ) it shows this error ( shown in image ) and what could be wrong?
Thank you.


8 Replies
did you clear your migrations in your database
I don't work a lot with EF Core but I believe there is a table to track migrations in your DB
With dotnet ef migrations remove?
that is how you should remove a migration instead of deleting it yourself from disk, and I think that handles removing the migration from the database as well
I deleted whole database also
😬 I deleted it from the disk instead of cmd and I think that’s problem and now I am struggling with clearing this migration
make sure you save your files as well
based on the error it looks like you are trying to register the DbContext itself multiple times
if you don't think you are doing that then you could try clean the solution: Build -> Clean
I double checked it and I have used DbContext only once and I also tried dotnet clean
I see your are using a db context factory, where is this being used?
Unknown User•6h ago
Message Not Public
Sign In & Join Server To View