Visual Studio 2010 MVC 2 Upgrade Wizard

Prior to the RTM release of Visual Studio 2010, the only way to upgrade an ASP.Net MVC 1 application to ASP.Net MVC 2 was to use Eilon Lipton’s tool. With the release of Visual Studio 2010 you will now be able to open your MVC 1 projects in Visual Studio 2010 and upgrade them to ASP.Net MVC 2 projects. Also, you can upgrade the target framework of the project to 4.0 or continue to target the 3.5 framework. When you first open an ASP.Net MVC 1 application in Visual Studio 2010, you will see the familiar Visual Studio Conversion Wizard.


image 


ASP.Net MVC specific code runs during this wizard and updates all System.Web.MVC references from version 1 to version 2. The wizard also updates the version numbers in the project’s Web.config and the Views folder’s Web.config. The project guid is also updated to the MVC 2 project guid so you will now be able to take advantage of Add Area while working on your application.


image


If you upgrade your project to 4.0, the project system will also upgrade System.Web.Routing and System.Web.Abstractions to 4.0 and modify the references in the project’s Web.config. At this point, you should be able to build and run your project.


image


What about class libraries and Visual Studio Test projects in my solution?


Unless you are using Visual Web Developer Express, the ASP.Net MVC upgrade wizard code does not upgrade your class libraries to the 4.0 framework, so make sure to upgrade them in the project properties if you choose to target the 4.0 framework when upgrading your ASP.Net MVC Application. Also you should check to make sure that class library references to System.Web.Abstractions and System.Web.Routing point to the version in the gac, now that these two assemblies are part of the 4.0 framework. Visual Studio Test projects do not support multi-targeting but for solutions with ASP.Net MVC applications they can be migrated to 4.0 along with your MVC Application.



  • If you are using C#, your VS Test project will upgrade to 4.0 regardless of whether you upgrade your ASP.Net MVC 2 Application and your project will build and run whether you target 3.5 or 4.0.

  • Visual Basic test projects will prompt for an upgrade to 4.0 so choose according to which framework you wish to target for your ASP.Net MVC app. In other words, don’t upgrade your app to 4.0 and not upgrade your test project or vice versa.


image


Hope this helps you get your ASP.Net MVC apps up and running in Dev10!


Joe Cartano | Visual Web Developer