Visual Studio 2013 button to add a View is disabled

后端 未结 2 475
陌清茗
陌清茗 2021-01-12 05:07

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?

相关标签:
2条回答
  • 2021-01-12 05:23

    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.

    0 讨论(0)
  • 2021-01-12 05:26

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

    0 讨论(0)
提交回复
热议问题