Migrating ASP.NET MVC 1.0 applications to ASP.NET MVC 2 RTM

Posted by Eilon on ASP.net Weblogs See other posts from ASP.net Weblogs or by Eilon
Published on Thu, 11 Mar 2010 06:00:00 GMT Indexed on 2010/03/11 17:20 UTC
Read the original article Hit count: 2197

Filed under:
|
|

Note: ASP.NET MVC 2 RTM isn’t yet released! But this tool will help you get your ASP.NET MVC 1.0 applications ready for when it is!

I have updated the MVC App Converter to convert projects from ASP.NET MVC 1.0 to ASP.NET MVC 2 RTM.

This should be last the last major change to the MVC App Converter that I released previews of in the past several months.

MVC App Converter screen shot

Download

The app is a single executable: Download MvcAppConverter-MVC2RTM.zip (255 KB).

Usage

The only requirement for this tool is that you have .NET Framework 3.5 SP1 on the machine. You do not need to have Visual Studio or ASP.NET MVC installed (unless you want to open your project!). Even though the tool performs an automatic backup of your solution it is recommended that you perform a manual backup of your solution as well.

  • To convert an ASP.NET MVC 1.0 project built with Visual Studio 2008 to an ASP.NET MVC 2 project in Visual Studio 2008 perform these steps:
    • Launch the converter
    • Select the solution
    • Click the “Convert” button
  • To convert an ASP.NET MVC 1.0 project built with Visual Studio 2008 to an ASP.NET MVC 2 project in Visual Studio 2010:
    • Wait until Visual Studio 2010 is released (next month!) and it will have a built-in version of this tool that will run automatically when you open an ASP.NET MVC 1.0 project
    • Perform the above steps, then open the project in Visual Studio 2010 and it will perform the remaining conversion steps

What it can do

  • Open up ASP.NET MVC 1.0 projects from Visual Studio 2008 (no other versions of ASP.NET MVC or Visual Studio are supported)
  • Create a full backup of your solution’s folder
  • For every VB or C# project that has a reference to System.Web.Mvc.dll it will (this includes ASP.NET MVC web application projects as well as ASP.NET MVC test projects):
    • Update references to ASP.NET MVC 2
    • Add a reference to System.ComponentModel.DataAnnotations 3.5 (if not already present)
  • For every VB or C# ASP.NET MVC Web Application it will:
    • Change the project type to an ASP.NET MVC 2 project
    • Update the root ~/web.config references to ASP.NET MVC 2
    • Update the root ~/web.config to have a binding redirect from ASP.NET MVC 1.0 to ASP.NET MVC 2
    • Update the ~/Views/web.config references to ASP.NET MVC 2
    • Add or update the JavaScript files (add jQuery, add jQuery.Validate, add Microsoft AJAX, add/update Microsoft MVC AJAX, add Microsoft MVC Validation adapter)
  • Unknown project types or project types that have nothing to do with ASP.NET MVC will not be updated

What it can’t do

  • It cannot convert projects directly to Visual Studio 2010 or to .NET Framework 4.
  • It can have issues if your solution contains projects that are not located under the solution directory.
  • If you are using a source control system it might have problems overwriting files. It is recommended that before converting you check out all files from the source control system.
  • It cannot change code in the application that might need to be changed due to breaking changes between ASP.NET MVC 1.0 and ASP.NET MVC 2.

Feedback, Please!

If you need to convert a project to ASP.NET MVC 2 please try out this application and hopefully you’re good to go. If you spot any bugs or features that don’t work leave a comment here and I will try to address these issues in an updated release.

© ASP.net Weblogs or respective owner

Related posts about ASP.NET

Related posts about mvc