Entity Framework Code First “Unable to generate an explicit migration because the following explicit migrations are pending”

I ran into this error “Unable to generate an explicit migration because the following explicit migrations are pending”.

Common causes include:

  1. You really have some pending migrations.  You can do “update-database –verbose” to apply the pending migrations.
  2. Your solution have multiple projects (e.g. WebAppProject, DataModelProject) and the wrong project is set as the start up project.  So just go to Visual Studio and select the right project and then set it as a startup project.
  3. You changed the ContextKey value in the Migrations\Configuration.cs.  You can always check the [dbo].[__MigrationHistory] entries to see if the ContextKeys match.  If Configuration.cs does not have a ContextKey, that should be fine.
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s