I just upgraded my MVC4 project to .NET 4.5 and EF5 and started using VS2012.
After realizing I needed to set-up auto-migrations in the Package Manager again I ran Enable-Migrations - EnableAutomaticMigrations
and received the error
No context type was found in the assembly 'MySolutionName'.
Some Research has said that it has to do with EF5 not enabling prereleases. I ran Install-Package EntityFramework -IncludePrerelease
but it said EF5 was already installed (which it was when I installed it through the NuGetmanager earlier without specifying -IncludePrerelease.
Does anyone know what I have to do to enable migrations for my project?
I was also faced the same problem, but after a day I suddenly get attention to a file called packages.config in the ASP MVC 4 project folder. So, here i get
I changed the version number to my appropriate number i.e. for me i used EF ver 5.0.0. After I change the version, everything is fine now.
I just had the same problem and found your question while searching for a solution.
I got it working. The problem, for me, was that I initially targeted the .NET 4.0 framework when I added the EF 5 via NuGet. Changing the target framework and then reinstalling EF 5 via NuGet, fixed it. It's also possible (see comments) that just reinstalling EF 5 via NuGet is the solution for you.
I had the following line in the App.config file, notice Version=4.4.0.0:
So what I did was set the target framework to 4.5 inside the solution configuration and set the supported runtime to 4.5 too (inside the app config).
Old:
New:
After that change, I removed EF 5.0 via NuGet and added it again. It gave me the following configSection as result, notice Version=5.0.0.0:
After that change, it worked.