ASP.Net MVC 1.0 in Visual Studio 2010

断了今生、忘了曾经 提交于 2019-12-04 04:26:01

Visual Studio 2010 will come with ASP.NET MVC 2.0 out of the box, so your best bet is converting your existing 1.0 project to 2.0.

Your ASP.NET MVC 1.0 project should be (almost) fully compatible with ASP.NET MVC 2.0 (there are a small number of minor breaking changes). All that is required for converting the project to ASP.NET MVC 2.0 is a GUID change in the project file.

See the ASP.NET MVC 2.0 Release Notes for more information about compatibility and conversion.

Everything seemed to be fine. I was able to get it to work, though it took a little bit of hacking.

  1. Convert the MVC 1.0 solution to MVC 2.0 using this tool.
  2. Open the upgraded solution in VS 2010.
  3. Remove the reference to MVC 2.0 and add a reference to the 1.0 version of System.Web.Mvc.dll you hopefully saved. Make sure to flag the "Copy Local" property of this 1.0 reference to true.
  4. Go through the [mvc project root]\Web.config and [mvc project root]\Views\Web.config files and change the version 2.0.0 to 1.0.0 anyplace you see a reference to System.Web.Mvc.
<pages validateRequest="false" pageParserFilterType="System.Web.Mvc.ViewTypeParserFilter, System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" pageBaseType="System.Web.Mvc.ViewPage, System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" userControlBaseType="System.Web.Mvc.ViewUserControl, System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
  <controls>
    <add assembly="System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" namespace="System.Web.Mvc" tagPrefix="mvc" />
  </controls>
</pages>

I had replaced references to System.Web.MVC, Version 2.0.0.0 with 1.0.0.0, but I was getting View not found errors because the System.Web.Mvc.ViewTypeParserFilter and System.Web.Mvc.ViewPage were using Verision 2.0.0.0 in web.config.

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