TAG | migrating mvc 2.0 to 3.0
Aug/10
4
Migrating project from ASP.NET MVC 2.0 to 3.0 Preview 1
No comments · Posted by A.K. in Software, Web Development
I just downloaded ASP.NET MVC 3.0 to test out the new Razor view engine. The problem is that the previous project created in MVC 2.0 needed to be changed as well. This step is nearly identical to the process in migrating from 1.0 to 2.0. The following content is blatant plagiarism with a few details modified,
To manually upgrade an existing ASP.NET MVC 1.0 application to version 2, follow these steps:
- Make a backup of the existing project.
- In a text editor, open the project file (the file with the .csproj or .vbproj file extension) and find the ProjectTypeGuid element. As the value of that element, replace the GUID {F85E285D-A4E0-4152-9332-AB1D724D3325} with {E53F8FEA-EAE0-44A6-8774-FFD645390401}. When you are done, the value of that element should be as follows:
{E53F8FEA-EAE0-44A6-8774-FFD645390401};{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}
- In the Web application root folder, edit the Web.config file. Search for System.Web.Mvc, Version=2.0.0.0 and replace all instances with System.Web.Mvc, Version=3.0.0.0.
- Repeat the previous step for the Web.config file located in the Views folder. (Additional note: There are 4 places that you need to change to 3.0.0.0 in this file.)
- Open the project using Visual Studio, and in Solution Explorer, expand the References node. Delete the reference to System.Web.Mvc (which points to the version 1.0 assembly). Add a reference to System.Web.Mvc (v3.0.0.0).
- Add the following bindingRedirect element to the Web.config file in the application root under the configuraton section:
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>(Additional note: I just replaced this entire section in my old Web.Config. Unless you have other elements, I would recommend doing the same thing.)
- Create a new empty ASP.NET MVC 2 application. Copy the files from the Scripts folder of the new application into the Scripts folder of the existing application.
- Update the existing application’s CSS file with the CSS style definitions in the Site.css file.
- Good luck!
