MVC scaffolding does not support Entity Framework 6 or later

MrBeanzy picture MrBeanzy · Oct 3, 2013 · Viewed 35k times · Source

Just upgraded to Entity Framework 6 to take a look. I'm using MVC4.

But i recieve this message when trying to make a controller from a model and context.

MVC scaffolding does not support Entity Framework 6 or later

Answer

5had3sofQu4rtz picture 5had3sofQu4rtz · Nov 26, 2014

Thought this could use some expanding :) As mentioned above ASP.NET MVC 4 scaffolding does not support EF6 or higher. This means that an older EF, compatible with MVC 4 will have to be installed. To do this:

  1. Open the Package Manager Console:
    • select TOOLS -> Library Package Manager -> Package Manager Console
  2. In the Package Manager Console, uninstall the current EF package by executing the following command:

    UnInstall-Package EntityFramework -Version <version number>

    *Where <version number> is the version number of the EF currently installed.
    *NOTE: to find out what EF version is installed, run the following command in the Package Manager Console:

    Get-Package EntityFramework

  3. To avoid potential metadata problems the providers entry in the Web.config file will need to be removed:

    • Open the Web.config file in the project directory.
    • Delete the following lines:

      <providers> <provider invariantName=System.Data.SqlClient type=System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer /> </providers>

  4. Now, in the Package Manager Console Execute the following command to install Entity Framework 5.0.0:

    Install-Package EntityFramework -Version 5.0.0