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?
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:
Install MVCScaffolding using NuGet
PM> Install-Package MvcScaffolding
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
Learn the basic MVCScaffolding commands
MvcScaffolding: Standard Usage
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With