Kaveh Shahbazian
Kaveh Shahbazian

Reputation: 13523

Add View context menu item is gone

I am going through Music Store tutorial (ASP.NET 3/Razor). After I have created the Home controller and Index action, I have right-clicked everywhere in Index action body (and declaration) and "Add View" does not show up.

I have tried Ctrl+M, Ctrl-V but it says this combination "is bound to command (Add View...) which is not currently available.".

Note: This is VS 2010; I had installed NDjango NuGet package which I thought caused this. But even after uninstalling that package the problem remains.

Upvotes: 3

Views: 1977

Answers (6)

Durga Maddhali
Durga Maddhali

Reputation: 1

If the function in the controller does not return ActionResult then the context menu will not show "Add View".

Upvotes: 0

ovais
ovais

Reputation: 369

I have also faced the same issue and I read a post found here:

http://www.techiesweb.net/how-to-get-add-view-add-controller-menus-in-solution-explorer-when-converting-existing-asp-net-web-for-project-to-mvc/

Which helped me alot and i want to share it for you guys. Hope this will help you alot.

Upvotes: 0

Boris
Boris

Reputation: 11

I had the same problem, but when I look more closely, I saw that action method (in the case of music store tutorial HomeController.Index) returns string. Modify method to return ActionResult and then Add View menu item will be available.

Upvotes: 1

Lee Vaughn-Ogin
Lee Vaughn-Ogin

Reputation: 450

Not sure if you were upgrading a website project from a previous version, but what I did was add {E53F8FEA-EAE0-44A6-8774-FFD645390401}; to the list of ProjectGuids in the project file itself (you need to unload the project, make the edit, and then reload the project.

That worked for me.

Upvotes: 4

Kaveh Shahbazian
Kaveh Shahbazian

Reputation: 13523

I created another MVC 3 project and Add View menu item was available. I had not the time to uncover resolutions so re-created the project from ground up; and It worked! I don't know re-installing MVC 3 has any effect, but this seems to be the solution.

Upvotes: 2

Simon Owen
Simon Owen

Reputation: 202

Have you tried reinstalling the MVC3 bits? I guess that's what adds the Add View and Goto View context menu items.

Upvotes: 0

Related Questions