You’ve probably read that Visual Studio 2010 supports multi-targeting: with the flick of a project property switch, the compiler can generate binaries for either the .NET 3.5 or .NET 4 platforms. And in fact, when you upgrade a Visual Studio 2008 solution to 2010, the upgrader will set the target framework to 3.5 so that your code compiles and runs exactly as before. (New projects, by default, target .NET 4.)
However, this is only true for C# and VB projects; C++/CLI projects will automatically be upgraded to .NET 4 and the new VC10 compiler. It is possible to change this, but there is no UI1; you have to edit the project file manually. And, most importantly, Visual Studio 2008 SP1 must be installed side-by- side for this to work2. The VC10 compiler has no support for .NET 3.5, so Visual Studio will invoke the VC9 compiler (included in VS2008) if you target the .NET 3.5 platform.
To change the target framework3:
<PropertyGroup Label="Globals">
<TargetFrameworkVersion>
child element; if not present add it.<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
if you want to target the client profile (or remove that element if it exists to target the full framework)4.Notes:
Posted by Bradley Grainger on April 15, 2010