Entity Framework Code Migrations - Stuck on Initial Migration

后端 未结 7 1078
面向向阳花
面向向阳花 2020-12-14 07:58

I have added EF 5 to my project via Nuget and enabled migrations with the \"Enable-Migrations\" command. I have then called \"Add-Migration\" to generate the base code for g

7条回答
  •  北海茫月
    2020-12-14 08:36

    I run Update-Database and get the same error again. I try "Update-Database -TargetMigration 201304080859556_MyMigration -Force" but this produces "The specified target migration '201304080859556_MyMigration' does not exist. Ensure that target migration refers to an existing migration id" - It does!

    There is one more issue which may cause your last error (and maybe it's a root cause of previous ones). I had a similar problem and it turned out that for some strange reason some of my migration classes where in a different namespace than the namespace of my MigrationConfiguration class. Correcting namespaces (also in xxx.Designer.cs files) solved this issue (migrations were visible and working again).

提交回复
热议问题