Upgrading an ASP.NET MVC 2 Project to ASP.NET MVC 3

ASP.NET MVC 3 Preview 1 – MVC-3-Preview-1-Release-Notes.doc
ASP.NET MVC Preview 3 Release – ScottGu
ASP.NET MVC 3 Preview 1 Released : Channel 9 Video and Hanselminutes Podcast 224, Oh My!
ASP.NET MVC 3 Preview 1 Released – Phil Haack

ASP.NET MVC 3 can be installed side by side with ASP.NET MVC 2 on the same computer, which gives you flexibility in choosing when to upgrade an ASP.NET MVC 2 application to ASP.NET MVC 3.

The simplest way to upgrade is to create a new ASP.NET MVC 3 project and copy all the views, controllers, code, and content files from the existing MVC 2 project to the new project and then to update the assembly references in the new project to match the old project. If you have made changes to the Web.config file in the MVC 2 project, you must also merge those changes with the Web.config file in the MVC 3 project.

To manually upgrade an existing ASP.NET MVC 2 application to version 3, do the following:

    1. In both Web.config files in the MVC 3 project, globally search and replace the MVC version. Find the following:
System.Web.Mvc, Version=

Replace it with the following

System.Web.Mvc, Version=

There are three changes in the root Web.config and four in the Views\Web.config file.

  1. In Solution Explorer, delete the reference to System.Web.Mvc (which points to the version 2 DLL). Then add a reference to System.Web.Mvc (v3.0.0.0).
  2. In Solution Explorer, right-click the project name and then select Unload Project. Then right-click again and select Edit ProjectName.csproj.
  3. Locate the ProjectTypeGuids element and replace {F85E285D-A4E0-4152-9332-AB1D724D3325} with {E53F8FEA-EAE0-44A6-8774-FFD645390401}.
  4. Save the changes and then right-click the project and select Reload Project.
  5. If the project references any third-party libraries that are compiled using ASP.NET MVC 2, add the following highlighted bindingRedirect element to the Web.config file in the application root under the configuration section:
  <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <assemblyIdentity name="System.Web.Mvc"
      <bindingRedirect oldVersion="" newVersion=""/>

<:footer>This entry was posted in ASP.NET, C#, MVC and tagged , . Bookmark the permalink.







About eagle081183

Passionate, Loyal
This entry was posted in ASP.NET MVC, C#. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s