我如何打开在Visual Studio 2012或Visual Studio 2013的老MVC项目? [英] How do I open an old MVC project in Visual Studio 2012 or Visual Studio 2013?

查看:695
本文介绍了我如何打开在Visual Studio 2012或Visual Studio 2013的老MVC项目?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个旧的ASP.NET MVC 2的项目,我不希望升级到MVC 3或4 MVC我运行Windows 8新机时,Visual Studio 2012和Visual Studio 2013在工作时我尝试打开VS 2012和VS 2013的MVC 2项目,我收到错误消息:

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:

此项目是与Visual Studio

This project is incompatible with the current edition of Visual Studio

于是项目被卸载并在Solution Explorer中显示为灰色。我不想安装Visual Studio的另一个副本。我怎样才能在Visual Studio中的一个新的版本中打开一个旧的MVC项目?

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中打开一个不支持MVC项目2012 或Visual Studio 2013实际上是pretty容易用两个步骤来完成。事实上,作为<一href=\"http://stackoverflow.com/questions/13424079/how-do-i-open-an-mvc-2-project-in-visual-studio-2012/13424080#comment18796578_13424080\">bytebender’s评论指出,这些相同的步骤 申请和工作MVC项目1项。不过,我没有测试过,因此不能保证它们其实工作要做。

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.

假设你没有这样做第一步是下载并安装 MVC 1 MVC 2 或的MVC 3 (在开始安装前关闭的Visual Studio)。

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适当味道安装该项目将仍然无法在2012年VS加载这是因为ASP.NET MVC项目是一个的project亚型中的Web应用程序项目类型。这意味着,在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.

双方的Visual Studio 2012和Visual Studio 2013在其向后与ASP.NET MVC和其他项目类型的兼容性是有限的。不幸的是,在安装旧MVC位没有改变。 的Visual Studio 2012兼容与ASP.NET MVC 3和第4项目的味道。 的Visual Studio 2013兼容,提供4 MVC和MVC 5。

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.

要拿到项目加载,你将不得不修改项目文件。要做到对卸载的项目,这样点击右键并选择编辑。这将打开项目文件作为一个XML文本文件。发现这应该是这个样子的 ProjectTypeGuids 节点:

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:

<ProjectTypeGuids>
    {F85E285D-A4E0-4152-9332-AB1D724D3325};{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}
</ProjectTypeGuids>

从列表中删除相应的项目GUID:

Remove the appropriate Project Guid from the list:


  • ASP.NET MVC 1: {603c0e0b-db56-11dc-be95-000d561079b0}

  • ASP.NET MVC 2: {F85E285D-A4E0-4152-9332-AB1D724D3325} (上面的例子所示)

  • ASP.NET MVC 3: {E53F8FEA-EAE0-44A6-8774-FFD645390401}

  • ASP.NET MVC 4: {E3E379DF-F4C6-4180-9B81-6769533ABE47}

  • ASP.NET MVC 1: {603c0e0b-db56-11dc-be95-000d561079b0}
  • ASP.NET MVC 2: {F85E285D-A4E0-4152-9332-AB1D724D3325} (shown in example above)
  • ASP.NET MVC 3: {E53F8FEA-EAE0-44A6-8774-FFD645390401}
  • ASP.NET MVC 4: {E3E379DF-F4C6-4180-9B81-6769533ABE47}

通过相应的GUID删除 ProjectTypeGuids 应类似于此:

With the appropriate GUID removed the ProjectTypeGuids should look similar to this:

<ProjectTypeGuids>
    {349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}
</ProjectTypeGuids>

保存文件并关闭Visual Studio项目文件编辑器。右键单击该项目并选择重新加载。如果该项目不刷新关闭并重新打开Visual Studio中。您现在应该能够在您的新的Visual Studio版本与旧的ASP.NET MVC项目工作。

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是不知道,这是一个ASP.NET MVC项目;因此,项目的具体功能,如添加控制器,视图等。不会在菜单present。

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 2012或Visual Studio 2013的老MVC项目?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆