Tuesday, November 6, 2012

Entity Framework 5 requires NuGet 2

After upgrading to Entity Framework 5, the Enable-Migrations command starting failing. I had used it with EF 4.3, but now I kept getting the following error when running Enable-Migrations in the Package Manager Console:

The EntityFramework package manager is not installed on project 'MigrationTest'.

But why? I clearly had EF5 installed, and I wasn't getting any build time errors. What's the problem? Well, after a lot of searching and research, I happened to read that EF 5 is only compatible with NuGet 2. I checked on the version I had installed, and sure enough, I was running NuGet 1.7. After upgrading to the most current version of NuGet, Enable-Migrations started working again.

I have two major issues with this.

  1. Why not a more clear error message? Telling me the package wasn't installed sent me off in the wrong direction.
  2. Why doesn't the Entity Framework Development Center state this information in the 'Get Entity Framework' section? There is no mention of EF 5 being incompatible with older versions of NuGet. Thanks guys.
In any case, if you find yourself upgraded Entity, don't forget to keep NuGet up to date as well.