Está en la página 1de 1

Using Visual Studio 2010 with .NET 2.

0
Suppose that you want the best of all worlds. You want to take advantage of the exciting new features in the Visual Studio 2010 development environment, such as the class designer and code snippets, and you still need to target the .NET 2.0 runtime environment. Well, my friend, that option is available to you. Note that you cant use any of the features of the .NET 4.0 framework, such as lambda functions, LINQ, and master pages. If you try, you receive an error message when you build your solution. Also, you cant use this trick with Web applications. ASP.NET uses a completely different build model than Windows applications and class libraries do. You can still get the lay of the Visual Studio 2010 land, though, while continuing to target previous versions of the .NET Framework. See Book III for more information about master pages and Book V for more information about working with generics. To target a previous version of .NET 2.0 with your application, follow these steps: 1. Open your Visual Basic or C# application in Visual Studio 2010 by using the File menu. If youre opening an application created in a previous version of Visual Studio, you need to walk through the Conversion Wizard steps before you can open the application.
Book II Chapter 4

Upgrading .NET

Using Visual Studio 2010 with .NET 2.0

123

2. Choose Tools Options and then click the Application tab.

The Options dialog box appears. 3. Choose .NET Framework 2.0 from the Target Framework drop-down list, shown in Figure 4-4.
Figure 4-4: Select .NET 2.0 from the list of available platforms.

4. Click OK.

The platform for your project is updated to .NET 2.0 in the Configuration Manager. When you build your application, Visual Studio 2010 targets the .NET 2.0 version of the .NET Framework. 5. Click the Close button to close the Configuration Manager. 6. Build your application by choosing Build Build Solution. The Microsoft team responsible for MSBuild is also working on its own tool for using Visual Studio 2010 with the .NET 2.0 compiler. Its project is named MSBee, which stands for MSBuild Everett Environment. MSBee works similarly to the MSBuild Toolkit. The main difference is that you cant use MSBee using the Visual Studio 2010 Build menu. Instead, you have to manually build your applications using the command line. You can download MSBee for free at www.codeplex.com/Wiki/View.aspx?ProjectName=MSBee. You arent restricted to using these two applications. The .targets files are what makes it possible to create .NET 2.0, .NET 3.0, and .NET 3.5 assemblies using Visual Studio 2010. You can browse the Web for .targets files or even write your own.

También podría gustarte