Migrating Asp.net MVC Projects from MVC 1.0 to 2.0


Written on Tuesday, April 06, 2010 by
The Asp.net Mvc 2.0 RTM came out last month and a lot of people are converting their projects over. If you're just starting to manually move your projects over then stop what you are doing, download and run the Mvc Converter. It will save you eons of time and frustration. If you are like me, however, and started porting your project over manually and are now knee deep in WTFBBQ sauce then follow the steps below and your project should be up and running in no time. 1. Back up your project. Just in case. 2. Open your project file(s) inside your favorite text editor (one with a decent find/replace system). Open the Find & Replace dialog and find "603c0e0b-db56-11dc-be95-000d561079b0", replacing it with "F85E285D-A4E0-4152-9332-AB1D724D3325". My project turned up 1 result. 3. Open the Web.Config files in the root of the project and the root of the /Views folder. Open the Find & Replace dialog again, this time searching for "System.Web.Mvc, Version=1.0.0.0" and replacing it with "System.Web.Mvc, Version=2.0.0.0". 4. Add the following BindingRedirect to the bottom of the root Web.Config, just before the </Configuration> node.

<runtime>
  <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
    <dependentAssembly>
      <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35"/>
      <bindingRedirect oldVersion="1.0.0.0" newVersion="2.0.0.0"/>
    </dependentAssembly>
  </assemblyBinding>
</runtime>
5. Open the solution in Visual Studio and replace the references to System.Web.Mvc 1.0 with the 2.0 assembly. 6. Finally, and only if you really need them, open a new MVC 2.0 project and copy all the files in the /Scripts folder to your project. Enjoy your freshly migrated project!
Back

Let's talk about this

 


The opinions expressed herein are my own and do not represent my employer's view in any way.


Creative Commons License