enable-migrations error : project failed to build

This can also happen if you are building a 64-bit application. Switch to "Any CPU", at least temporarily while building the migrations, and the problem may go away. This is just one thing that can cause that error, though.


Executing "Enable-Migrations" from the package manager console requires a reference to a specific DbContext. For example

PM> Enable-Migrations -ContextTypeName myMvcApp.Web.Infrastructure.ContextDb

You do not need to install a 3rd party assembly or any other assembly other than the EntityFramework 4.3+ (the command above is for EF 5.0. This is not a well documented but essential feature of the EF.