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

ASP.NET MVC 2 RTM has just been released! More info on ScottGu's blog.

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.

Published Wednesday, March 10, 2010 10:00 PM by Eilon
Filed under: , ,

Comments

# re: Migrating ASP.NET MVC 1.0 applications to ASP.NET MVC 2 RTM

Friday, March 12, 2010 3:29 AM by Troels Thomsen

Please let backing up be configurable. Hopefully, we all use some kind of source control, so it is completely irrelevant (and causing bad performance for a huge solution).

# re: Migrating ASP.NET MVC 1.0 applications to ASP.NET MVC 2 RTM

Tuesday, March 16, 2010 1:26 PM by Fabrizio Battaglia

Hi Scott, I'm using the your tool for converting a middle-size project. Everything seems to be went good, except for a little issue: opening the just modified web.config I recived a message regarding the line feed type: VS don't recognises the standard LFCR in some place in the file. However VS corrects the error automatically and I haven't experience other bad things.

Thank you a lot for your tool, and your great web casts.    

# re: Migrating ASP.NET MVC 1.0 applications to ASP.NET MVC 2 RTM

Wednesday, March 17, 2010 5:22 PM by Steve Gentile

Thank you for providing this!

Fantastic

# re: Migrating ASP.NET MVC 1.0 applications to ASP.NET MVC 2 RTM

Friday, March 19, 2010 4:01 AM by WestWeb

Great tool, went flawless!

# re: Migrating ASP.NET MVC 1.0 applications to ASP.NET MVC 2 RTM

Friday, March 19, 2010 4:41 PM by goodbyeforms

Works like a charm, thanks. Couldn't be easier. And if you're using stuff like Html.RenderAction from the futures project for MVC 1, don't foget to download the new microsoft.web.mvc for MVC 2 from

aspnet.codeplex.com/.../41742. (RenderAction is now part of mvc 2 proper.)

# re: Migrating ASP.NET MVC 1.0 applications to ASP.NET MVC 2 RTM

Saturday, March 20, 2010 11:39 AM by tx

thanks ! good tool,

if using VSS (source safe) make sure you checkout all files.

# re: Migrating ASP.NET MVC 1.0 applications to ASP.NET MVC 2 RTM

Sunday, March 21, 2010 2:49 AM by assistant

I want't to know how to get the common contrl forexample freetextbox,fckeditor,aspnetpager,and so on to embed the mvc.

# re: Migrating ASP.NET MVC 1.0 applications to ASP.NET MVC 2 RTM

Wednesday, April 21, 2010 8:51 PM by Steve Whalen

Great tool! Thank you!

# re: Migrating ASP.NET MVC 1.0 applications to ASP.NET MVC 2 RTM

Sunday, May 2, 2010 11:53 AM by James Randall

Worked great for me - thanks!

# re: Migrating ASP.NET MVC 1.0 applications to ASP.NET MVC 2 RTM

Tuesday, May 11, 2010 9:41 PM by Clifton Mullen

Clear usage notes, worked great.  Thanks!

# re: Migrating ASP.NET MVC 1.0 applications to ASP.NET MVC 2 RTM

Wednesday, June 9, 2010 5:51 AM by cepeleon

Awesome utility, thanks!

# re: Migrating ASP.NET MVC 1.0 applications to ASP.NET MVC 2 RTM

Friday, April 8, 2011 11:12 AM by Chris Breish

This saved me a bunch of time.  Thanks for posting it.

# re: Migrating ASP.NET MVC 1.0 applications to ASP.NET MVC 2 RTM

Monday, August 15, 2011 7:23 AM by Julian Guppy

This does not appear to work i have vs 2008 studio project mvc 1.0 each project says has an unknown type and will not be converted? how do i fix this?

# re: Migrating ASP.NET MVC 1.0 applications to ASP.NET MVC 2 RTM

Thursday, August 18, 2011 4:55 PM by Eilon

@Julian Guppy

Are the projects marked as being MVC projects? Can you check that the csproj file has the appropriate <ProjectTypeGuid> entries in it? It should look like this:

<ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{F184B08F-C81C-45F6-A57F-5ABD9991F28F}</ProjectTypeGuids>

But instead of just having two GUIDs, there should be three GUIDs in there (the third one being the MVC GUID, which changes for each version of MVC).

Thanks,

Eilon

# re: Migrating ASP.NET MVC 1.0 applications to ASP.NET MVC 2 RTM

Sunday, October 9, 2011 11:16 AM by Vincent

not working! my project is mvc 1.0 using vs2008, It doesn't work!