To manually upgrade an existing ASP. net mvc 2 Application to version 3, perform the following steps:
1. Create an empty ASP. net mvc 3 Project on your computer. This project contains the files required for the upgrade.
2. Copy the following files from the ASP. net mvc 3 project to the corresponding location of your asp. Net MVC 2 project. You will need to update all references to the jquery library to modify the name of the new library (jQuery-1.5.1.js) [jquery used in MVC, with the version number, bringing some trouble to the provincial upgrade ]:
·/Views/Web. config
·/Packages. config
·/Scripts/*. js
·/Content/themes /*.*
3. In the root directory of the ASP. net mvc 3 project solutionPackagesCopy the folder to the root directory of your solution (in the directory where the. sln file is located.
4. If your ASP. net mvc 2 project contains any region, copy the/views/Web. config file to the Views folder of each areas.
5. In the two web. config files of ASP. net mvc 2 project, search globally and replace ASP. net mvc. Find the following content:
System. Web. MVC, version = 2.0.0.0
Replace it with the following:
System. Web. MVC, version = 3.0.0.0
6. in Solution Explorer, delete. web. reference MVC (which points to the DLL in version 2), and then add. web. reference of MVC (v3.0.0.0.
7. Add references to system. webpages. dll and System. Web. helpers. dll. These assemblies are located in the following folders:
· % ProgramFiles % \ Microsoft ASP. NET \ ASP. net mvc 3 \ assemblies
· % ProgramFiles % \ Microsoft ASP. NET \ ASP. NET web pages \ V1.0 \ assemblies
8. In Solution Explorer, right-click the project name and select uninstall project ". Then, right-click the project name and select "edit ".Project name. Csproj ".
9. Find the projecttypeguids element and replace {F85E285D-A4E0-4152-9332-AB1D724D3325} with {E53F8FEA-EAE0-44A6-8774-FFD645390401 }.
10. Save the changes, right-click the project, and select "reload project ".
11. In the application's root web. config file, add the following settings to the assemblies section.
<add assembly="System.Web.WebPages, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> <add assembly="System.Web.Helpers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
12. if the project references any use of ASP. net MVC 2 compiled third-party library, add the following highlighted bindingredirect elements to the Web. under the configuration section of the config file.
<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>
13. Add the MVC assembly in the dependent Project
System. Web. MVC, version = 2.0.0.0
Replace it with the following:
System. Web. MVC, version = 3.0.0.0
OK, so that the MVC2 project is successfully upgraded to mvc3.