Visual Studio 2013 button to add a View is disabled

╄→гoц情女王★ 提交于 2019-12-19 05:57:16

问题


After creating a few views, the AddView>Add button became disabled and I can't add views anymore. Does anyone have a hint about that?

EDIT

I can add views using the Add New Item command and selecting Views, but it's nonsense to me.


回答1:


You may well have solved this by now, but I thought I'd add my answer for others suffering with this issue.

This same issue happened to me, and the solution was to edit the .csproj file to tell Visual Studio that it was an MVC project.

Here's what you do:

1) Open up the .csproj file of the MVC project in a text editor (Notepad is fine).

2) Find the tag .

3) For visual Studio 2013 it should read like this (may work for 2012 also):

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

4) Save the changes - Visual Studio will detect them and re-load the project.

Here's why you do it:

All that line in the .csproj file does is tells Visual Studio which type of project it is.

E3E379DF-F4C6-4180-9B81-6769533ABE47 = ASP.NET MVC 4.0

349c5851-65df-11da-9384-00065b846f21 = Web Application

fae04ec0-301f-11d3-bf4b-00c04f79efbc = C#

In your case, I expect E3E379DF-F4C6-4180-9B81-6769533ABE47 is missing, so VS doesn't know that it's an MVC project, therefore won't allow you to add Views and Controllers.

You can look up the various guids here in case you ever need them. http://www.codeproject.com/Reference/720512/List-of-Visual-Studio-Project-Type-GUIDs

I hope this is a help to you.




回答2:


It seem that one of update for visual studio is not installed completely. you can uninstall visual studio or re-install last update.



来源:https://stackoverflow.com/questions/23435315/visual-studio-2013-button-to-add-a-view-is-disabled

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!