I am using Visual studio 2015 and after opening an existing project, I am not able to see the add controller option while right clicking on the Controller Folder. Please help.
-
[This answer](http://stackoverflow.com/a/38369200/1252036) helped me to resolve the same problem – Victor Sharovatov Oct 30 '16 at 10:28
11 Answers
- Open VS2015=>TOOLS=>Customize
- Select Commands
- Select Context menu
- Select Project and Solution Context Menus|Folder|Add
- Check that 'Controller' appears.
- IMPORTANT - Move up Controller item to the top.

- 28,994
- 18
- 176
- 206
-
3Following this made the Controller option appear for me but clicking the controller option doesn't actually do anything! – thudbutt Nov 26 '15 at 16:14
-
3Same here, I now have the option to add a controller which is invisible, inaudible, tasteless and odourless. I tried reaching out with my feelings, but even the force couldn't detect it. I would have preferred a chocolate teapot. At least I could console myself with confectionery therapy. – GPR Dec 01 '15 at 16:17
-
1I was under the impression these context options for **Controller** or **Views** appear depending on the NuGet packages you have installed in **project.json**, specifically Entity Framework packages in conjunction with the **Microsoft.Extensions.CodeGenerators.Mvc** package. I noticed this when building my project up from an empty template and then gradually adding packages I needed. At some point, the Controller and Views context menu items seemed to be made available. – Darren Evans Apr 02 '16 at 12:16
-
1Just did a test from an Empty Project and it was only after adding the following packages to project.json that the Controller and View context menu items appeared: EntityFramework.Commands": "7.0.0-rc1-final", EntityFramework.MicrosoftSqlServer": "7.0.0-rc1-final", "Microsoft.Extensions.CodeGenerators.Mvc": "1.0.0-rc1-final" – Darren Evans Apr 02 '16 at 12:32
-
-
@niico Afraid I didn't, I think I was using an RC version and I put it down to that. – thudbutt Apr 09 '17 at 19:00
-
@thudbutt thanks - doing a full re-install here (only did a complete machine wipe 2 weeks ago). – niico Apr 09 '17 at 21:27
I had the same problem on my ASP.NET project in VS2015. I solved by installing Microsoft.VisualStudio.Web.CodeGeneration.Tools.
It doesn't appear in NuGet Manager so you have to install with Package Manager Console: Install-Package Microsoft.VisualStudio.Web.CodeGeneration.Tools -Version 1.0.0-preview2-final -Pre
Hope it helps

- 101
- 2
- 4
I had the same issue. After messing around with the GUID numbers and trying to reinstall, the answer came down to updating Visual Studio 2015.
Go to Tools > Extensions and Updates > Updates (Tab on the left) > Visual Studio.
It was around 3 Gigs.
Hope this helps

- 962
- 9
- 21
-
I had the issue and updated "github extension" in "Go to Tools > Extensions and Updates > Updates". After restarting VS2015, the add controller menu item was back. I guess updating any Extensions will do. – sunpochin Feb 07 '16 at 18:11
OK, this was driving me up the wall so I created a default MVC project to see what on earth I was missing, would you like to know?? Here is the answer.
In project.json under dependencies, please add:
"Microsoft.Extensions.CodeGenerators.Mvc": "1.0.0-rc1-final"
Or which ever version is now available. Then right click your folders for views etc and the menu options appear!

- 598
- 8
- 19
From [Chris Zhao on asp.net][1]: You could consider uninstalling VS 2015, and reinstall it again,and check whether "Web Developer tools" is selected [go into Custom during the installation to be sure it is checked.
I did this and it enabled the add controller option.
Right Click on Add Reference --> ManageNugetPackage --> Search for Microsoft ASPNET.MVC and Install that package. Then come back to project and right-click on controller folder and see ;-)

- 11
- 1
Use the following command in the NuGet console to install the package.
Install-Package Microsoft.Extensions.CodeGenerators.Mvc -Pre
Good Luck.

- 735
- 5
- 10
Adding the following 2 dependencies in project.json worked for me to get Add controller and view context menus as well as the scaffolding. I have VS 2015 with Update 3.
Under dependencies -
"Microsoft.VisualStudio.Web.CodeGeneration.Tools": {
"version": "1.0.0-preview2-final",
"imports": [
"portable-net45+win8"
]
},
"Microsoft.VisualStudio.Web.CodeGenerators.Mvc": "1.0.0-preview2-final"
And under Tools section:
"Microsoft.VisualStudio.Web.CodeGeneration.Tools": {
"version": "1.0.0-preview2-final",
"imports": [
"portable-net45+win8"
]
}

- 691
- 1
- 7
- 19
-
it works for me after update "vs 2015 update 3" and I don't know, is update important or not? – Ali.azimi May 23 '17 at 20:17
-
If you have recently cleaned all the files in your solution then it may just be a matter of re-building the solution, to restore your NuGet packages.

- 3,314
- 4
- 36
- 45
I followed every step and nothing worked. so the problem is definitely related to the code generators, but what I had to do is include booth codeGenerator.MVC and CodeGeneration.Tools in the dependencies section
"Microsoft.VisualStudio.Web.CodeGeneration.Tools": "1.0.0-preview2-final",
"Microsoft.VisualStudio.Web.CodeGenerators.Mvc": {
"type": "build",
"version": "1.0.0-preview2-final"
}
And the following in the tools section
"Microsoft.VisualStudio.Web.CodeGeneration.Tools": "1.0.0-preview2-final"
enter code here
FYI: No need to follow the steps TOOLS=>Customize, once the code generator is added the Controller will appear immediately.

- 1,507
- 20
- 33
I had the same problem. I closed and re-opened Visual Studio and then the issue solved.

- 971
- 2
- 11
- 29