The out-of-the-box ASP.NET migration tool in Visual Studio 2005 is the Web Site Project, which is based on the dynamic compilation model. Microsoft learned shortly after the release of VS 2005 that the Web Site project required some manual code fixes and was a bit cumbersome for large Web projects.
To that end, Microsoft released the Web Application Project in May 2006. This is based on the client project model, and it compiles into a single assembly while allowing multiple configurations, said Omar Khan, group program manager for Visual Studio Web Tools.
The Web Application Project, or WAP, was included in Visual Studio 2005 Service Pack 1. Microsoft's Visual Studio 2005 Web Application Projects page provides information on what developers should do if they have not installed VS 2005 SP 1 or still have the separate WAP add-on.
Though developers could update a Web application's script map to ASP.NET 2.0 and still develop using Visual Studio 2003, Khan said Microsoft recommends migrating using WAP. "We definitely feel this is the path of least resistance, and it gives you all the benefits of ASP.NET 2.0 within the IDE," he continued.
At Tech Ed 2006, Khan provided a five-step process for migrating Web projects from ASP.NET 1.x to ASP.NET 2.0. If a project is error-free in Visual Studio 2003, then a developer can migrate in less than 30 minutes with "very little manual steps required," Khan said.
Make sure the Web Application Project is available. As stated, this was included in Visual Studio 2005 Service Pack 1.
Validate the application in Visual Studio 2003. Open the application in VS 2003, perform a build and validate all projects and page functions. Khan also suggested running the app in the browser to check for errors in ASPX files.
Open Visual Studio 2005 and launch the Conversion Wizard. It's best to migrate an entire solution at once, but if you plan to do individual projects, then start with "bottom of the food chain" items like class code and shared libraries, Khan said. Once the wizard has run its course, perform a build.
Errors that may need fixing at this point include in-line VB code in ASPX pages and name collisions. The latter occur when VS 2003 types don't quite fit into the corresponding default namespace in Visual Studio 2005, and they can be remedied by fully qualifying the namespace, Khan said. Once errors have been cleaned up, run the application and validate its functionality.
Convert to partial classes. One of Visual Studio 2005's many new features is partial classes, which separates a developer's code-behind file from the designer file that Visual Studio creates. (These files come together at compile time.) To convert the pages in your application to partial classes, right-click on the root mode of a Web project and select "Convert to Web Application. This will move generated code into a designer.cs or designer.vb file, depending on the language you are using.
As in Step 3, the next task is performing a build and correcting the errors that arise. In this case, Khan said, the error is likely to be a missing control declaration. This can be added to either the designer file or the code-behind file; Khan recommended the code-behind file, since it changes only at a developer's discretion.
Fix up XHTML errors, if desired. In VS 2003, the default validation for a Web application is the IE 6 schema. Developers can leave validation for a migrated application on IE 6 or, through the Tools option, change the validation to XHTML, open the app's individual pages and correct and errors. Khan cautioned that this can be a lengthy process.
As an aside, Khan offered developers one additional consideration. Some types have been deprecated in Visual Studio 2005, meaning the types are fully supported now but will not be in future versions of Visual Studio. During a migration from ASP.NET 1.x to 2.0, a developer may see a set of errors for deprecated classes and recommendations for alternate classes. A fix is not necessary for ASP.NET 2.0, but, Khan said, "you'll definitely run into a point where it won't compile."