Unable to generate an explicit migration because the following explicit migrations are pending

To resolve this issue, I changed my default project to the one with the app.config containing the proper connection string.

This should have been obvious, since the system was detecting none of the migrations as applied - an obvious sign that it was not finding the DB, an obvious reason for that being that it could not find the connection string (as OP concluded).

"Hindsight is 20/20".


I was also getting this error. In addition to correctly setting the Default Project (as mentioned by ANeves), I also had to set the project with the connection string as the StartUp Project in Solution Explorer. Only once I correctly set both of these did the error go away.


Finally I found the problem! As Mohamad Bataineh said in this thread (see the answers)

In your DbContext class, you have need to specify the base class constructer with the proper name to your sql source. For example name=MyDBEntities

In the other word I changed my existing dbcontext's constructor

public MyDbContext()
{
} 

To

public MyDbContext(): base("name=ERPContext")
{
}