Converting Web Applications
Converting Web Applications
The conversion process for Web applications is more involved than for Windows applications and class libraries. The Visual Studio Conversion Wizard performs several additional functions when converting Web applications, including the following:
Book II Chapter 4
Upgrading .NET
119
Move project file configuration settings into the web.config file. Create new folders, such as App_Code, and move stand-alone class files. Update the code behind attributes to reflect new attributes. Because the Web application conversion process is more involved, the preparation requires that you do a few more preparation tasks as well: Make sure that all files that need to be converted are included in the project. The Visual Studio Conversion Wizard converts only those files. To include in a project any files that were previously excluded, open the project in Visual Studio 2002, 2003, 2005, or 2008, right-click the file, and then choose Include in Project from the contextual menu. Remove any files from your project directory that arent part of the project. When you convert multiple projects, make sure that no overlap occurs in the files that each project references. When you convert multiple solutions, make sure that no overlap occurs in the projects contained in the solutions. Remove references to other Web projects. To convert a Web application, follow these steps: 1. Choose File Open Web Site. The Open Web Site window appears. You must open your Web site using the Open Web Site window in order for the Conversion Wizard to work properly. The Open Web Site window gives you several sources from which you can open your Web site. In most cases, youll open your site from a local IIS site. You can also choose to open a site from a File Transfer Protocol (FTP) site, remote Web server, or source control. Dont select File System as your source. Converting a Web application from a file system causes the Web site to lose data about the sites structure. 2. Select Local IIS from the list of sources in the left pane. A list of Web sites on the local computer appears. 3. Navigate to the Web site you want to convert, select it (as shown in Figure 4-2), and then click the Open button. The Visual Studio Conversion Wizard appears.
120
Figure 4-2: Open an existing Web site by using the Local IIS option.
4. Click Next to start the wizard. 5. Follow the steps in the Visual Studio Conversion Wizard to complete
the conversion. If errors occur in the conversion, read the conversion log and determine which files werent converted. Remember that class files arent converted.
Theyre copied to the solution directory as-is. You may check the ConversionReport.webinfo file to view the steps taken to convert the application. The file is named ConversionReport. txt if you havent installed the Conversion Wizard upgrade. Build your applications by making sure that all dependent projects are built first. Always open your converted project by using the Local IIS option. After the conversion, you have an ASP.NET 4.0 Web application that you can edit in Visual Studio 2010. The folder structure and code-behind model are updated to the new ASP.NET 4.0 model.