Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MVC scaffolding does not support Entity Framework 6 [duplicate]

I'm trying to add a controller with read/write actions and views, using Entity Framework.

But when I try so, VS2012 tells me that "MVC scaffolding does not support Entity Framework 6 or later". I've read http://support.microsoft.com/kb/2816241 and tried to uninstall EntityFramework 6 and install 5 in Nuget Manager Console:

PM> Uninstall-package EntityFramework -force Removing 'EntityFramework 6.0.2' from OnlinebookingAdministrator. Successfully removed 'EntityFramework 6.0.2' from OnlinebookingAdministrator. Uninstalling 'EntityFramework 6.0.2'. Successfully uninstalled 'EntityFramework 6.0.2'.

PM> Install-Package EntityFramework -version 5.0.0 'EntityFramework 5.0.0' already installed. Adding 'EntityFramework 5.0.0' to OnlinebookingAdministrator. Successfully added 'EntityFramework 5.0.0' to OnlinebookingAdministrator.

But the error keeps showing up when I try to add the controller. Is there a solution to this?

like image 436
perene Avatar asked Jan 21 '14 09:01

perene


1 Answers

I'm afraid I don't have a perfect solution to your problem, however I think I've got a pretty decent workaround:

I've had many arguments with the default MVC Scaffold-er of late, I'd recommend installing MVCScaffolding via NuGet and using the console to create anything you require.

Steps to Fix:

  1. Install MVCScaffolding using NuGet

    PM> Install-Package MvcScaffolding
    
  2. Run the following command via Package Manager Console replacing ModelName with the name of the model you wish to generate Controllers/Views for.

    PM> Scaffold Controller ModelName
    
  3. Learn the basic MVCScaffolding commands

    MvcScaffolding: Standard Usage

like image 90
Matthew Hudson Avatar answered Nov 12 '22 18:11

Matthew Hudson