on Geeks with Blogs
See other posts from Geeks with Blogs
or by navaneeth
Published on Mon, 31 May 2010 03:51:36 GMT Indexed on 2010/05/31 22:03 UTC
Read the original article Hit count: 857
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 ASP.NET Web Application Projects.
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.
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.
Converting the Project and Upgrading the .NET Framework Version
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.
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
- In Visual Studio 2008, in the File menu, click Open and then click Project.
The Open Project dialog box is displayed.
- Browse to the folder that contains the project or solution file for the Visual Studio .NET project, select the file, and then click Open.
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.
- To create the backup, click Yes.
- Click Browse, select the folder in which the backup should be created, and then click Next.
- Click Finish.
The backup starts.
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.
- 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.
- Click OK.
The wizard displays status information about the conversion.
- Click Close.
Testing the Converted Project
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
- If you know about changes that are required for the code to run with the new version of the .NET Framework, make those changes.
- 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.
- In Solution Explorer, right-click the Web page that will be used to launch the application, and then click Set as Start Page.
- 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.
- Verify that the converted project runs as expected.
Do not continue with the conversion process until all build and run-time errors are resolved.
Converting ASP.NET Code Files
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.
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
- In Solution Explorer, right-click the project node, and then click Convert To Web Application.
The files are converted.
- Verify that the converted code files have a code file and a designer file.
- Build and run the project to verify the results of the conversion.
© Geeks with Blogs or respective owner