Поделиться через


How to: Modify the Target Framework and Platform Toolset

You can change Visual C++ 2010 project settings to target different versions of the .NET Framework and different tools. By default, the project system uses the .NET Framework 4 and Visual C++ 2010 tools. You can change the target platform toolset by modifying the project properties. You can change the target Framework by modifying the project (.vcxproj) file. You do not have to maintain a separate code base for every compilation target. When you change the target Framework, also change the platform toolset to the version that supports the target Framework. For example, to target the .NET Framework 2.0, 3.0, or 3.5, you must use the v90 platform toolset.

Note

In addition to targeting the correct platform toolset, you must also have the associated version of Visual Studio installed. For example, to target the .NET Framework 2.0, 3.0, and 3.5, and the v90 platform toolset, you must have Visual Studio 2008 installed. However, you can use Visual C++ 2010 to do your development work, provided that you target the correct Framework version and platform toolset.

You can extend the target platform further by creating a custom platform toolset. For more information, see C++ Native Multi-Targeting on the Visual C++ blog.

To change the target Framework

  1. In the editor, open the project (.vcxproj) file for your project.

  2. Locate the entry for the target Framework version. For example, if your project is designed to use the .NET Framework 4, locate <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>

  3. Change the value to the Framework version you want.

  4. Save the changes and close the editor.

  5. In Solution Explorer, right-click your project and then click Properties. In the Property Pages window, in the left pane, expand Common Properties and then select Framework and References. Verify that the new Framework version appears at the top of the right pane.

To change the project toolset

  1. In Visual Studio, open the Property Pages for your project. In the left pane, expand Configuration Properties and then select General.

  2. In the right pane, select Platform Toolset and then select the toolset you want. For example, if you want to compile against the Visual Studio 2008 libraries, select v90.

  3. Click OK.

See Also

Other Resources

MSBuild (Visual C++)