Migrating ASP.NET MVC 2 applications to ASP.NET MVC 3 Preview 1

ASP.NET MVC 3 Preview 1 has just been released! More info on ScottGu's blog.

Download ASP.NET MVC 3 Preview 1!

I just finished up a preview of my ASP.NET MVC application conversion tool to support conversions from ASP.NET MVC 2 to ASP.NET MVC 3.

The previous version of the app that converted from ASP.NET MVC 1.0 to ASP.NET MVC 2 is available here.

image

Download

The app is a single executable: Download MvcAppConverter-MVC3Preview1.zip (256 KB).

Usage

The only requirement for this tool is that you have .NET Framework 4 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 2 project built with Visual Studio 2010 to an ASP.NET MVC 3 project in Visual Studio 2010 perform these steps:
    • Launch the converter
    • Select the solution
    • Click the “Convert” button
  • To convert an ASP.NET MVC 2 project built with Visual Studio 2008 to an ASP.NET MVC 2 project in Visual Studio 2010:
    • Open the project in Visual Studio 2010 to convert the solution and project file formats from VS2008 to VS2010
    • Upgrade the .NET Framework target version of each project to .NET Framework 4 because ASP.NET MVC 3 is compatible with only .NET Framework 4
    • Launch the converter
    • Select the solution
    • Click the “Convert” button

What it can do

  • Open up ASP.NET MVC 2 projects from Visual Studio 2010 (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
  • For every VB or C# ASP.NET MVC Web Application it will:
    • Change the project type to an ASP.NET MVC 3 project
    • Update the root ~/web.config references to ASP.NET MVC 3
    • Update the root ~/web.config to have a binding redirect from ASP.NET MVC 2 to ASP.NET MVC 3
    • Update the ~/Views/web.config references to ASP.NET MVC 3
  • 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 build with Visual Studio 2008 or with .NET Framework 3.5.
  • 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 2 and ASP.NET MVC 3.
  • The release notes include manual steps to upgrade your application.

Feedback, Please!

If you need to convert a project to ASP.NET MVC 3 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.

Other Resources

There are already a bunch of blog posts, walkthroughs, and even videos on the new preview, so check them out:

Brad Wilson has a four-part post on ASP.NET MVC 3’s new dependency injection support:

Published Wednesday, July 28, 2010 10:34 AM by Eilon

Comments

# Twitter Trackbacks for Migrating ASP.NET MVC 2 applications to ASP.NET MVC 3 Preview 1 - Eilon Lipton's Blog [asp.net] on Topsy.com

Pingback from  Twitter Trackbacks for                 Migrating ASP.NET MVC 2 applications to ASP.NET MVC 3 Preview 1 - Eilon Lipton's Blog         [asp.net]        on Topsy.com

# re: Migrating ASP.NET MVC 2 applications to ASP.NET MVC 3 Preview 1

Thursday, July 29, 2010 5:08 AM by Sergey

Successfully converted to MVC 3.

Though status text is slightly disappointing:)

"The project was successfully converted

The solution was successfully converted to ASP.NET MVC 2"

# re: Migrating ASP.NET MVC 2 applications to ASP.NET MVC 3 Preview 1

Thursday, July 29, 2010 5:43 PM by Eilon

Hi Sergey,

I think I uploaded an old version of the tool by mistake! I changed the ZIP to be the updated version.

Thanks for the report!

# MVC 3 – Supporting Custom View Engines

Friday, July 30, 2010 11:14 AM by Jacques Eloff

  MVC 3 Preview 1 was released earlier this week. It’s packed with new features such as dependency

# What Is ASP Hosting And What Can It Do For You?

Thursday, August 05, 2010 2:29 AM by What Is ASP Hosting And What Can It Do For You?

Pingback from  What Is ASP Hosting And What Can It Do For You?

# re: Migrating ASP.NET MVC 2 applications to ASP.NET MVC 3 Preview 1

Wednesday, August 11, 2010 1:16 PM by Felipe Lima

Worked fine except for one of the project on my solution, which was targeted to .NET 3.5 so the added reference was not found, since MVC 3 is targeted to .NET 4. Just updated the target framework and worked fine.

Thanks a lot :)

# re: Migrating ASP.NET MVC 2 applications to ASP.NET MVC 3 Preview 1

Wednesday, August 18, 2010 2:38 PM by Phil

strongly typed views are having issues thinking the Model is of type object getting

'object' does not contain a definition for ...

I used the converter but this is busted ... all in web.config looks on the up and up.  Anyone else?

# re: Migrating ASP.NET MVC 2 applications to ASP.NET MVC 3 Preview 1

Wednesday, August 18, 2010 2:47 PM by Eilon

@Phil

>>>>>>>> strongly typed views are having issues thinking the Model is of type object getting

>>>>>>>>

>>>>>>>> 'object' does not contain a definition for ...

>>>>>>>>

>>>>>>>> I used the converter but this is busted ... all in web.config looks on the up and up.  Anyone else?

Are you having issues with strongly-typed views with the WebForm view engine or the Razor view engine? There may have been a bug in the WebForm view engine that we just recently fixed. I think there was also a small bug in the Razor view engine that we also just recently fixed.

If you can share the file that isn't working we'll take a look.

Thanks!

Leave a Comment

(required) 
(required) 
(optional)
(required)