MVC scaffolding does not support Entity Framework 6 or later

前端 未结 4 1482
南笙
南笙 2020-12-29 22:44

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.

4条回答
  •  轮回少年
    2020-12-29 23:13

    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

      *Where 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:

    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

提交回复
热议问题