7

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

4 Answers 4

18

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.

Sign up to request clarification or add additional context in comments.

2 Comments

I am trying to add when the project is not in run mode. Still not able to add it.
@Indigenuity The option isn't even available when running in code so this is wrong.
2

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

2 Comments

This isn't a very high quality answer. Please read How to answer.
@AgataB how is it not a high quality answer? This is the correct answer.
1

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.

Comments

0

Why not just click Add > Controller.. or if for some reason its not there Add > New Item.. > MVC 4 Controller Class

Is there a particular reason you MVC 5 controller with views using EE because on my VS 2013 I do not even see that option?

1 Comment

Yes I have to do it via add > new scaffolded item > mvc5 with views.. The screen pops up, to fill in extra information, I just can't confirm. The final "Add" button is greyed out.. I'm doing it like this because it says so in asp.net/mvc tutorial

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.