Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

visual studio 2013 'add controller' missing

Tags:

I update the visual studio 2010 project to visual studio 2013. Then I want to ad a new controller. but there is no add Controller option.

enter image description here

But If I create a new project in 2013 it already have the add Controller option. So how to add the new Controller? something missing in web.config or missing reference?

like image 741
aruni Avatar asked Nov 08 '13 01:11

aruni


People also ask

How do I add a controller in Visual Studio 2013?

For Visual Studio 2013 (Released Version)Right Click on the "Controllers" folder in your MVC project. Add > Controller... Choose a Controller Template. (I prefer MVC 5 Controller Empty)

How do I add a controller in Visual Studio?

Using the Add Controller Menu Option The easiest way to create a new controller is to right-click the Controllers folder in the Visual Studio Solution Explorer window and select the Add, Controller menu option (see Figure 1). Selecting this menu option opens the Add Controller dialog (see Figure 2).

How do I add a controller in Visual Studio 2012?

In Solution Explorer, right-click the Controllers folder and then select Add Controller. Name your new controller "HelloWorldController". Leave the default template as Empty MVC controller and click Add. Notice in Solution Explorer that a new file has been created named HelloWorldController.

How do I add a controller in Visual Studio 2010?

Create a new controller by right-clicking the Controllers folder in Solution Explorer and then selecting Add Controller. Name your new controller "HelloWorldController" and click Add. Notice in Solution Explorer on the right that a new file has been created for you named HelloWorldController.


2 Answers

Make sure your .proj file includes all the appropriate project type Guids.

<ProjectTypeGuids>{E3E379DF-F4C6-4180-9B81-6769533ABE47};{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids> 

The first GUID allows all standard MVC operations in the context menus.

like image 170
user3705013 Avatar answered Sep 19 '22 05:09

user3705013


In my case Unloding and Reloading the project solved the problem. To unload - right click on the project name and choose "Unload Project" from the context menu. Then again right click on the project name and select "Reload Project" from the context menu.

enter image description here

enter image description here

like image 20
feradz Avatar answered Sep 22 '22 05:09

feradz