I have an old ASP.NET MVC 2 project which I do not want to upgrade to MVC 3 or MVC 4. I am working on a new machine running Windows 8, Visual Studio 2012 and Visual Studio 2013. When I try to open the MVC 2 project in VS 2012 or VS 2013 I receive the error:
我有一个老ASP。NET MVC 2项目,我不想升级到MVC 3或MVC 4。我正在开发一台运行Windows 8、Visual Studio 2012和Visual Studio 2013的新机器。当我尝试在VS 2012或VS 2013中打开MVC 2项目时,我收到了错误:
This project is incompatible with the current edition of Visual Studio
这个项目与当前版本的Visual Studio不兼容。
The project is then unloaded and grayed out in Solution Explorer. I do not want to install another copy of Visual Studio. How can I open an old MVC project in a new version of Visual Studio?
然后在解决方案资源管理器中卸载该项目并使其变灰。我不想安装另一个Visual Studio的副本。如何在Visual Studio的新版本中打开一个旧的MVC项目?
3 个解决方案
#1
278
Opening an unsupported MVC project in Visual Studio 2012 or Visual Studio 2013 is actually pretty easy to accomplish with two steps. In fact, as bytebender’s comment indicates, these same steps should apply to and work for MVC 1 projects. However, I haven’t tested them and therefore cannot guarantee that they do in fact work.
在Visual Studio 2012或Visual Studio 2013中打开一个不支持的MVC项目实际上很容易通过两个步骤来完成。实际上,正如bytebender的评论所指出的,这些步骤应该适用于MVC 1项目并适用于它们。但是,我还没有对它们进行测试,因此不能保证它们确实有效。
Assuming that you have not already done so step one is to download and install MVC 1, MVC 2 or MVC 3 (close Visual Studio before starting the installation).
假设您还没有这样做,第一步是下载并安装MVC 1、MVC 2或MVC 3(在开始安装之前关闭Visual Studio)。
Once you have the appropriate flavor of MVC installed the project will still not load in VS 2012. This is because ASP.NET MVC projects are a project subtype of the Web Application project type. This means that the project has additional add ins and features available to it when used within Visual Studio.
一旦你安装了合适的MVC,项目将不会在VS 2012中加载。这是因为ASP。NET MVC项目是Web应用程序项目类型的项目子类型。这意味着当在Visual Studio中使用时,项目有额外的添加ins和可用特性。
Both Visual Studio 2012 and Visual Studio 2013 are limited in their backwards compatibility with ASP.NET MVC and other project types. Unfortunately, installing the old MVC bits did not change that. Visual Studio 2012 is compatible with the ASP.NET MVC 3 and 4 project flavors. Visual Studio 2013 is compatible with MVC 4 and MVC 5.
Visual Studio 2012和Visual Studio 2013在向后兼容ASP方面都受到限制。NET MVC和其他项目类型。不幸的是,安装旧的MVC位并没有改变这一点。Visual Studio 2012与ASP兼容。NET MVC 3和4个项目风格。Visual Studio 2013兼容MVC 4和MVC 5。
To get the project to load you will have to modify the project file. To do so right click on the unloaded project and select Edit. Which will open the project file as an XML text file. Find the ProjectTypeGuids
node which should look something like this:
要加载项目,您必须修改项目文件。为此,右键单击卸载的项目并选择Edit。它将以XML文本文件的形式打开项目文件。找到像这样的ProjectTypeGuids节点:
<ProjectTypeGuids>
{F85E285D-A4E0-4152-9332-AB1D724D3325};{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}
</ProjectTypeGuids>
Remove the appropriate Project Guid from the list:
从列表中删除适当的项目Guid:
- ASP.NET MVC 1:
{603c0e0b-db56-11dc-be95-000d561079b0}
- ASP。净MVC 1:{ 603 c0e0b db56 - 11 -直流be95 - 000 d561079b0 }
- ASP.NET MVC 2:
{F85E285D-A4E0-4152-9332-AB1D724D3325}
(shown in example above) - ASP。NET MVC 2: {F85E285D-A4E0-4152-9332-AB1D724D3325}(如上例所示)
- ASP.NET MVC 3:
{E53F8FEA-EAE0-44A6-8774-FFD645390401}
- ASP。净MVC 3:{ e53f8fea - eae0 - 44 - a6 - 8774 ffd645390401 }
- ASP.NET MVC 4:
{E3E379DF-F4C6-4180-9B81-6769533ABE47}
- ASP。净MVC 4:{ e3e379df f4c6 - 4180 - 9 b81 - 6769533 - abe47 }
With the appropriate GUID removed the ProjectTypeGuids
should look similar to this:
使用适当的GUID删除项目时,应该类似如下:
<ProjectTypeGuids>
{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}
</ProjectTypeGuids>
Save the file and close the Visual Studio project file editor. Right click the project and select reload. If the project does not reload close and reopen Visual Studio. You should now be able to work with your old ASP.NET MVC project in your new version of Visual Studio.
保存文件并关闭Visual Studio项目文件编辑器。右键单击项目并选择reload。如果项目没有重新加载关闭并重新打开Visual Studio。现在您应该可以使用您的旧ASP了。NET MVC项目在您的新版本的Visual Studio中。
One important thing to note is that after these modifications Visual Studio is not aware that this is an ASP.NET MVC project; therefore the project-specific features like "Add Controller, View etc." will not be present in menus.
需要注意的重要一点是,在这些修改之后,Visual Studio不知道这是一个ASP。净MVC项目;因此,“添加控制器、视图等”等项目特定的特性不会出现在菜单中。
#2
4
I used @ahsteele's approach (thanks and 2x+1s!), but was having one further error:-
我使用了@ahsteele的方法(谢谢和2x+1 !),但是还有一个错误:-
.csproj : error : The operation could not be completed. Invalid class string
错误:操作无法完成。无效的类的字符串
I can't find any citations for the real cause of that, but I was able to get VS2012RTM to load the project successfully by changing the <ProjectGuid>
. (No idea how this happened - its part of a large solution and VS08, VS10, VS11 Beta and VS2012RC have all upgraded the .csproj
and .sln
over time.
我找不到真正的原因,但是我可以通过改变
#3
0
In VS2017 the solution is to just make it like <ProjectTypeGuids></ProjectTypeGuids>
so.
在VS2017中,解决方案是将其设置为
No Spaces in between ladies and gentlemen, otherwise it will waste 48 hours of your time.
女士们和先生们之间没有空隙,否则会浪费你48小时的时间。
Regards
问候
#1
278
Opening an unsupported MVC project in Visual Studio 2012 or Visual Studio 2013 is actually pretty easy to accomplish with two steps. In fact, as bytebender’s comment indicates, these same steps should apply to and work for MVC 1 projects. However, I haven’t tested them and therefore cannot guarantee that they do in fact work.
在Visual Studio 2012或Visual Studio 2013中打开一个不支持的MVC项目实际上很容易通过两个步骤来完成。实际上,正如bytebender的评论所指出的,这些步骤应该适用于MVC 1项目并适用于它们。但是,我还没有对它们进行测试,因此不能保证它们确实有效。
Assuming that you have not already done so step one is to download and install MVC 1, MVC 2 or MVC 3 (close Visual Studio before starting the installation).
假设您还没有这样做,第一步是下载并安装MVC 1、MVC 2或MVC 3(在开始安装之前关闭Visual Studio)。
Once you have the appropriate flavor of MVC installed the project will still not load in VS 2012. This is because ASP.NET MVC projects are a project subtype of the Web Application project type. This means that the project has additional add ins and features available to it when used within Visual Studio.
一旦你安装了合适的MVC,项目将不会在VS 2012中加载。这是因为ASP。NET MVC项目是Web应用程序项目类型的项目子类型。这意味着当在Visual Studio中使用时,项目有额外的添加ins和可用特性。
Both Visual Studio 2012 and Visual Studio 2013 are limited in their backwards compatibility with ASP.NET MVC and other project types. Unfortunately, installing the old MVC bits did not change that. Visual Studio 2012 is compatible with the ASP.NET MVC 3 and 4 project flavors. Visual Studio 2013 is compatible with MVC 4 and MVC 5.
Visual Studio 2012和Visual Studio 2013在向后兼容ASP方面都受到限制。NET MVC和其他项目类型。不幸的是,安装旧的MVC位并没有改变这一点。Visual Studio 2012与ASP兼容。NET MVC 3和4个项目风格。Visual Studio 2013兼容MVC 4和MVC 5。
To get the project to load you will have to modify the project file. To do so right click on the unloaded project and select Edit. Which will open the project file as an XML text file. Find the ProjectTypeGuids
node which should look something like this:
要加载项目,您必须修改项目文件。为此,右键单击卸载的项目并选择Edit。它将以XML文本文件的形式打开项目文件。找到像这样的ProjectTypeGuids节点:
<ProjectTypeGuids>
{F85E285D-A4E0-4152-9332-AB1D724D3325};{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}
</ProjectTypeGuids>
Remove the appropriate Project Guid from the list:
从列表中删除适当的项目Guid:
- ASP.NET MVC 1:
{603c0e0b-db56-11dc-be95-000d561079b0}
- ASP。净MVC 1:{ 603 c0e0b db56 - 11 -直流be95 - 000 d561079b0 }
- ASP.NET MVC 2:
{F85E285D-A4E0-4152-9332-AB1D724D3325}
(shown in example above) - ASP。NET MVC 2: {F85E285D-A4E0-4152-9332-AB1D724D3325}(如上例所示)
- ASP.NET MVC 3:
{E53F8FEA-EAE0-44A6-8774-FFD645390401}
- ASP。净MVC 3:{ e53f8fea - eae0 - 44 - a6 - 8774 ffd645390401 }
- ASP.NET MVC 4:
{E3E379DF-F4C6-4180-9B81-6769533ABE47}
- ASP。净MVC 4:{ e3e379df f4c6 - 4180 - 9 b81 - 6769533 - abe47 }
With the appropriate GUID removed the ProjectTypeGuids
should look similar to this:
使用适当的GUID删除项目时,应该类似如下:
<ProjectTypeGuids>
{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}
</ProjectTypeGuids>
Save the file and close the Visual Studio project file editor. Right click the project and select reload. If the project does not reload close and reopen Visual Studio. You should now be able to work with your old ASP.NET MVC project in your new version of Visual Studio.
保存文件并关闭Visual Studio项目文件编辑器。右键单击项目并选择reload。如果项目没有重新加载关闭并重新打开Visual Studio。现在您应该可以使用您的旧ASP了。NET MVC项目在您的新版本的Visual Studio中。
One important thing to note is that after these modifications Visual Studio is not aware that this is an ASP.NET MVC project; therefore the project-specific features like "Add Controller, View etc." will not be present in menus.
需要注意的重要一点是,在这些修改之后,Visual Studio不知道这是一个ASP。净MVC项目;因此,“添加控制器、视图等”等项目特定的特性不会出现在菜单中。
#2
4
I used @ahsteele's approach (thanks and 2x+1s!), but was having one further error:-
我使用了@ahsteele的方法(谢谢和2x+1 !),但是还有一个错误:-
.csproj : error : The operation could not be completed. Invalid class string
错误:操作无法完成。无效的类的字符串
I can't find any citations for the real cause of that, but I was able to get VS2012RTM to load the project successfully by changing the <ProjectGuid>
. (No idea how this happened - its part of a large solution and VS08, VS10, VS11 Beta and VS2012RC have all upgraded the .csproj
and .sln
over time.
我找不到真正的原因,但是我可以通过改变
#3
0
In VS2017 the solution is to just make it like <ProjectTypeGuids></ProjectTypeGuids>
so.
在VS2017中,解决方案是将其设置为
No Spaces in between ladies and gentlemen, otherwise it will waste 48 hours of your time.
女士们和先生们之间没有空隙,否则会浪费你48小时的时间。
Regards
问候