Walkthrough: Converting a Visual Studio 2002 or 2003 Web Project to a Visual Studio 2008 Web Application Project

This walkthrough describes how to convert a Visual Studio .NET 2002 or Visual Studio .NET 2003 Web project to a Visual Studio 2008 Web application project. The Visual Studio 2008 Web application project model is like the Visual Studio 2005 Web application project model. Therefore, the conversion processes are similar. For more information about Web application projects, see Web Application Projects Overview.

You can also convert from a Visual Studio .NET Web project to a Visual Studio 2008 Web site project. However, conversion to a Web application project is the approach that is supported, and gives you the convenience of tools to help with the conversion. For example, when you convert to a Visual Studio 2008 Web application project, you can use the Visual Studio Conversion Wizard to automate part of the process. For information about how to convert a Visual Studio .NET Web project to a Visual Studio 2008 Web site, see Common Web Project Conversion Issues and Solutions.

There are two parts involved in converting a Visual Studio 2002 or 2003 Web project to a Visual Studio 2008 Web application project. The parts are as follows:

  • Converting the project. You can use the Visual Studio Conversion Wizard for the initial conversion of the project and Web.config files. You can later use the Convert To Web Application command to update the project's files and structure.

  • Upgrading the .NET Framework version of the project. You must upgrade the project's .NET Framework version to either .NET Framework 2.0 SP1 or to .NET Framework 3.5. This .NET Framework version upgrade is required because Visual Studio 2008 cannot target earlier versions of the .NET Framework. You can perform this upgrade during the project conversion, by using the Conversion Wizard. Alternatively, you can upgrade the .NET Framework version after you convert the project. 

    NoteNote:

    You can change a project's .NET Framework version manually. To do so, in Visual Studio open the property pages for the project, click the Application tab, and then select a new version from the Target Framework list.

This walkthrough illustrates the following tasks:

  • Opening the Visual Studio .NET project in Visual Studio 2008 and creating a backup of the project files.

  • Upgrading the .NET Framework version that the project targets.

  • Converting the project file and the Web.config file.

  • Converting ASP.NET code files.

  • Testing the converted project.

To complete this walkthrough, you will need:

  • Visual Studio 2008.

  • A Web site project that was created in Visual Studio .NET version 2002 or 2003 that compiles and runs without errors.

To begin, you open the project in Visual Studio 2008, which starts the conversion. It offers you an opportunity to back up the project before converting it.

NoteNote:

It is strongly recommended that you back up the project. The conversion works on the original project files, which cannot be recovered if the conversion is not successful.

To convert the project and back up the files

  1. In Visual Studio 2008, in the File menu, click Open and then click Project.

    The Open Project dialog box is displayed.

  2. Browse to the folder that contains the project or solution file for the Visual Studio .NET project, select the file, and then click Open.

    NoteNote:

    Make sure that you open the project by using the Open Project command. If you use the Open Web Site command, the project will be converted to the Web site project format.

    The Conversion Wizard opens and prompts you to create a backup before converting the project.

  3. To create the backup, click Yes.

  4. Click Browse, select the folder in which the backup should be created, and then click Next.

  5. Click Finish.

    The backup starts.

    NoteNote:

    There might be significant delays as the Conversion Wizard copies files, with no updates or progress indicated. Wait until the process finishes before you continue.

    When the conversion finishes, the wizard prompts you to upgrade the targeted version of the .NET Framework for the project.

  6. To upgrade to the .NET Framework 3.5, click Yes. To upgrade the project to target the .NET Framework 2.0 SP1, click No.

    It is recommended that you leave the check box selected that asks whether you want to upgrade all Webs in the solution.

    If you upgrade to .NET Framework 3.5, the project's Web.config file is modified at the same time as the project file.

    When the upgrade and conversion have finished, a message is displayed that indicates that you have completed the first step in converting your project.

  7. Click OK.

    The wizard displays status information about the conversion.

  8. Click Close.

After the conversion has finished, you can test the project to make sure that it runs. This will also help you identify code in the project that must be updated.

To verify that the project runs

  1. If you know about changes that are required for the code to run with the new version of the .NET Framework, make those changes.

  2. In the Build menu, click Build.

    Any missing references or other compilation issues in the project are displayed in the Error List window. The most likely issues are missing assembly references or issues with dynamically generated types.

  3. In Solution Explorer, right-click the Web page that will be used to launch the application, and then click Set as Start Page.

  4. On the Debug menu, click Start Debugging.

    If debugging is not enabled, the Debugging Not Enabled dialog box is displayed. Select the option to add a Web.config file that has debugging enabled, and then click OK.

  5. Verify that the converted project runs as expected.

    Do not continue with the conversion process until all build and run-time errors are resolved.

ASP.NET Web page files and user-control files in Visual Studio 2008 that use the code-behind model have an associated designer file. The files that you just converted will have an associated code-behind file, but no designer file. Therefore, the next step is to generate designer files.

NoteNote:

Only ASP.NET Web pages and user controls that have their code in a separate code file require a separate designer file. For pages that have inline code and no associated code file, no designer file will be generated.

To convert ASP.NET code files

  1. In Solution Explorer, right-click the project node, and then click Convert To Web Application.

    The files are converted.

  2. Verify that the converted code files have a code file and a designer file.

  3. Build and run the project to verify the results of the conversion.

Community Additions

ADD
Show: