Search code examples
c#asp.net-coreentity-framework-coreasp.net-core-2.0ef-core-2.0

Exception calling "Remove" with "0" argument(s): "The given key was not present in the dictionary


I have added a migration using Add-Migration, Now If I run Remove-Migration, it reverts the migration and remove the generated migration file successfully, but gives the error in Package Manager Console also. I could not figure out the exact reason behind it and side effect of it. Is this EF Core bug?

Package Manager Output:

PM> Remove-Migration Removing migration '20180320052521_testMigration'. Reverting model snapshot. Done. Exception calling "Remove" with "0" argument(s): "The given key was not present in the dictionary." PM>

EF Core Version: 2.0.1


Solution

  • The Application is always building when a migration is added to the Project as mentioned in the previous answers.

    This one is not actually a Solution, its more a workaround which is working for me at most.

    Try to remove your Migration mit following Command

    Remove-Migration NameOfMigration