No connection string named 'MyApplicationEntities' could be found in the application config file

Ah, figured this out accidentally.

I had to remove

public MasterEntities()
    : base("name=MyApplicationEntities")
    //      ^^^^^
{
}

to

public MasterEntities()
    : base("MyApplicationEntities")
{
}

EF 4.3 does not like connection string being called name=xxxxx


The solution as Sanj pointed out is that you need to copy the connection string from your database project's App.config to the web project's web.config. I'm not sure why the above answer is marked as correct. I'm adding this as an answer instead of a comment so future readers will spot this.


I had the same error but I already had a web.config file with the correct connection string name and a DbContext declared correctly. However, I noticed when I ran add-migration with -Verbose it state the 'Startup Project' as a different project than the one containing my context. So I change the Startup Project, re-ran the add-migration and it all worked!!