Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASP.NET MVC adding controller disabled

I'm using Visual Studio 2013 for web with MVC 5.

When trying to add a new controller to the "Controllers" map in my project, here's what I do: right click controllers, Add, New Scaffolded Item, "MVC 5 controller with views using EE". I fill in the Controller Name, Model class etc.. But the "Add" button is greyed out.

  • The project is selected.
  • I'm not in debugging mode
  • I'm able to add a class to Models folder
like image 328
RobSeg Avatar asked Dec 12 '14 20:12

RobSeg


3 Answers

The option to add a new Controller will be grayed out if your project is currently running. Stop execution and the option you describe should become available.

like image 191
Indigenuity Avatar answered Oct 15 '22 15:10

Indigenuity


I believe the model needs to be created prior to adding the scaffolding. I bet it works if you pick an existing model.

like image 2
user239642 Avatar answered Oct 15 '22 14:10

user239642


Add a model class first Add a new scaffolded item Attach the new model class Follow rest of the pop up window and the "Add" button becomes available.

like image 1
Tom McDonough Avatar answered Oct 15 '22 13:10

Tom McDonough