Vous êtes sur la page 1sur 2

Considering Your Conversion Strategies

Visual Studio provides a conversion wizard for migrating projects from previous versions of .NET to the .NET 4.0 version. The conversion process itself is fairly straightforward: You just open your Visual Studio 2002, 2003, 2005, or 2008 solution in Visual Studio 2010, and the Conversion Wizard automatically opens and walks you through the conversion process. Before you convert any applications, you need to do some preparation work on all of them: Make sure that you have good backups, in case you decide to roll back to the unconverted version. Make sure that all your source code compiles before you convert.
Book II Chapter 4

Upgrading .NET

Considering Your Conversion Strategies

117

Take the time to clean up any extraneous files that dont belong with the application. Make sure that the .NET 4.0 Framework is installed on all client machines that will run your application. Converting Web applications requires more preparation than converting Windows applications because the conversion process is more involved. See Converting Web applications, later in this chapter, for more details.

Converting Windows applications and class libraries


As a rule, you should try to convert an entire solution first rather than convert each of the projects in a solution individually. If the conversion process cant convert all the projects in your solution, you should Allow the Visual Studio Conversion Wizard to convert the solution and as many projects as it can. Open individual projects that dont convert in Visual Studio 2010. Walk through the Conversion Wizard for each project that doesnt convert with the solution. Add the converted projects to the converted solution. To convert Windows solutions and projects, follow these steps: 1. In Visual Studio 2010, choose File Open Project/Solution. The Open Project window appears. 2. Browse to your Visual Studio 2002, 2003, 2005, or 2008 Windows application and click the Open button. If you have a solution file, you should open it. The Visual Studio Conversion Wizard appears. 3. Click Next to start the wizard. 4. Click Select the radio button next to Yes, Create a Backup before Converting radio button, specify a backup location, and then click Next. Its a good idea to create a backup of your existing solution file in case something goes wrong in the conversion. If something goes awry, you can revert back to your backup copy. After you upgrade your solution file, you can no longer use it in previous versions of Visual Studio. A summary of the solution and projects to be converted is displayed.

118

Considering Your Conversion Strategies

5. Click the Finish button to start the conversion.

After the conversion is done, a completion window appears. Any errors that occur during the conversion process are listed. 6. To display a conversion log, select the Show the Conversion Log When the Wizard Is Closed option and then click the Close button.

The conversion log, shown in Figure 4-1, appears in Visual Studio 2010.
Figure 4-1: View the conversion log for details about the conversion process.

Follow these steps again to convert class libraries. After the conversion, build your application in Visual Studio 2010 to make sure that all converted projects are compiled. If you have multiple projects in your solution, you should build your class libraries first and work your way through any dependencies until all your components are built.

Vous aimerez peut-être aussi