When I user the Add-Migration command of Entity Framework migration I get the following exception:
System.NullReferenceException: Object referen
I've seen this before when there are multiple projects in the solution and the "wrong" project is selected as the startup project. For example, somebody else reported that in an Azure hosted MVC3 website they had the Azure project as the startup project instead of the MVC project. Switching over to the MVC project as the startup fixed the issue.
Update: This has been fixed in EF5-beta2, which is now available on NuGet.
You can actually very easily specify the target project in your Package Manager Console when calling any EF command by just using the correct flags and arguments, for instance, given a project called ProjectFoo out of a solution with multiple projects:
enable-migrations -projectname projectfoo
add-migration "Initial" -projectname projectfoo
update-database -projectname projectfoo
etc...Easy as pie.