NOTE: There is an updated version of this tool that is compatible with ASP.NET MVC 2 RTM.
Thanks to the great feedback I’ve received on my ASP.NET MVC conversion tool for ASP.NET MVC 2 Preview 2 I’ve updated it to support conversions to ASP.NET MVC 2 Beta. I’ve included a number of bugs fixes and improvements based on the feedback:
- A “Scripts” folder will be automatically created if one does not already exist
- References to the System.Web.Mvc.dll assembly will be updated to use the fully-qualified name (public key token, etc.)
- UI improvements
The app is a single executable: Download MvcAppConverter.zip (226 KB).
The only requirement for this tool is that you have .NET Framework 3.5 SP1 on the machine. You do not need to have Visual Studio or ASP.NET MVC installed (unless you want to open your project!). Even though the tool performs an automatic backup of your solution it is recommended that you perform a manual backup of the solution as well.
- To convert an ASP.NET MVC 1.0 project built with Visual Studio 2008 to an ASP.NET MVC 2 project in Visual Studio 2008 perform these steps:
- Launch the converter
- Select the solution
- Click the “Convert” button
- To convert an ASP.NET MVC 1.0 project built with Visual Studio 2008 to an ASP.NET MVC 2 project in Visual Studio 2010:
- Perform the above steps, then open the project in Visual Studio 2010 and it will perform the remaining conversion steps
What it can do
- Open up ASP.NET MVC 1.0 projects from Visual Studio 2008 (no other versions of ASP.NET MVC or Visual Studio are supported)
- Create a full backup of your solution’s folder
- For every VB or C# project that has a reference to System.Web.Mvc.dll it will (this includes ASP.NET MVC web application projects as well as ASP.NET MVC test projects):
- Update references to ASP.NET MVC 2
- Add a reference to System.ComponentModel.DataAnnotations 3.5 (if not already present)
- For every VB or C# ASP.NET MVC Web Application it will:
- Change the project type to an ASP.NET MVC 2 project
- Update the root ~/web.config references to ASP.NET MVC 2
- Update the root ~/web.config to have a binding redirect from ASP.NET MVC 1.0 to ASP.NET MVC 2
- Update the ~/Views/web.config references to ASP.NET MVC 2
- Unknown project types or project types that have nothing to do with ASP.NET MVC will not be updated
What it can’t do
- It cannot convert projects directly to Visual Studio 2010 or to .NET Framework 4.
- It can have issues if your solution contains projects that are not located under the solution directory.
- If you are using a source control system it might have problems overwriting files. It is recommended that before converting you check out all files from the source control system.
- It cannot change code in the application that might need to be changed due to breaking changes between ASP.NET MVC 1.0 and ASP.NET MVC 2. Consult the readme for information on breaking changes.
If you need to convert a project to ASP.NET MVC 2 please try out this application and hopefully you’re good to go. If you spot any bugs or features that don’t work leave a comment here and I will try to address these issues in an updated release.