How to: Target a Specific .NET Framework Version or Profile
This document describes how to create a project that targets a specific .NET Framework version or profile, and how to change the target .NET Framework version for an existing project. For more information about how to change the .NET Framework version for C++ projects, see How to: Modify the Target Framework and Platform Toolset.
In Express Editions of Visual Studio, a .NET Framework version or profile cannot be specified when a project is created. However, you can later retarget the project to any installed .NET Framework version.
Creating a Project
The following steps show how to create a project that targets a specific .NET Framework version.
To create a project that has a specific .NET Framework target
In Visual Studio, on the File menu, click New and then click Project.
In the New Project dialog box, select a project type, for example, Visual C# Windows.
In the list at the top of the New Project dialog box, select the .NET Framework version you want your project to target, for example, .NET Framework 4.
Visual Studio 2010 includes only the .NET Framework 4. To target earlier versions of the .NET Framework, you must have the .NET Framework 3.5 SP1 installed. To download and install the .NET Framework 3.5 SP1, see Microsoft .NET Framework 3.5 Service Pack 1 on the Microsoft Download Center website.
Click OK and then continue to create your project.
The set of available project templates depends on the .NET Framework version you select.
Changing the Target .NET Framework Version or Profile for an Existing Project
The following steps show how to change the .NET Framework target for an existing project.
To change the target .NET Framework version or profile
In Visual Studio, open the project you want to change.
Right-click the project in Solution Explorer and then click Properties.
In the Project Designer, locate the Target Framework list, as follows.
For Visual Basic projects, click the Compile tab and then click Advanced Compile Options. The Target Framework list is in the Advanced Compiler Settings dialog box.
For Visual C# projects, the Target Framework list is on the Application tab of the Project Designer. For more information, see Application Page, Project Designer (C#).
For Visual F# projects, the Target Framework list is on the Application tab of the Project Designer.
In the Target Framework list, select the .NET Framework version or profile that you want.
When you click OK, the project unloads and then reloads in the integrated development environment (IDE). The project now targets the .NET Framework version that you just selected.
If you change the .NET Framework version, you may receive error messages if your code contains references to a different version. To resolve these errors, you must manually modify the references. For more information, see Troubleshooting .NET Framework Targeting Errors.