VS2012 ProjectTypeGuids Lost when opening after installing ASP.NET and Web Tools 2013.1

為{幸葍}努か 提交于 2019-12-23 08:58:40

问题


I've installed the "ASP.NET and Web Tools 2013.1" in my Visual Studio 2012.

I have a solution which has an ASP.NET MVC 4 project with the following project type guids:

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

These Guids are for: ASP.NET MVC 4.0 Web Application Windows (C#)

This is the usual configuration when you create a new ASP.NET 4.0 project. And it works fine.

The problem is that, for some strange reason, whenever I open my solution the first GUID (ASP.NET MVC 4.0) is deleted from the .csproj file, so I lose all the related tooling.

No matter how I try to edit it:

  • if I close the solution, and edit this file manually, adding the missing GUID, when I open it again, the GUID is deleted
  • if I unload the project, edit the .csproj and reload it, the GUID is also deleted.
  • I have this project under version control (SVN), so I have also tried closing VS, updating the file in the SVN (using Tortoise) and reopening the solution. And you know what? The GUID is deleted when opening the solution !!!

If I create a new solution with an ASP.NET MVC 4.0 project, it works fine, and the GUIDs are kept.

Any idea why this can be happening and how I can solve it?

UPDATE

If I open VS in safe mode this doesn't happen. SO I suspect it must be an extension, but I don't know how to discover which is the offendign extension. Is there a way to know which extension can be responsible for this (apart from uninstall/try cycles...)


回答1:


I found a temporary workaround hack for this problem:

  1. Right click on the MVC project in Visual Studio and select "Unload Project"
  2. Right click on the project and select "Edit YourProjectName.csproj"
  3. Replace the contents of the ProjectTypeGuids tag with the following and save the file changes:

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

  4. Open up Window Explorer and find the csproj file. Open up properties on it and mark it as Read Only.

  5. In Visual Studio right click on the project and select Reload Project. You will be prompted to save as the csproj file. Hit Cancel when that comes up.
  6. Go back to Windows Explorer and take off the Read Only flag.

As long has you have this project open in Visual Studio, it will think it's an MVC project, and you will have options to Add Views and Controllers. Once you switch projects or restart Visual Studio, you'll have to do this again.



来源:https://stackoverflow.com/questions/22251165/vs2012-projecttypeguids-lost-when-opening-after-installing-asp-net-and-web-tools

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