#Google Analytic Tracker


Aug 30, 2011

Compiling C++ project using Visual Studio 2010 with .NET 4.0 from Visual Studio 2008 (MSB8009)

I know there are many posts on the internet for this solution. I like to blog about this so that next time when I have to update another C++ project file, I would remember I can reference my own blog post. Please note that I am not familiar with C++, but hopefully this information would help others.

Problem: When you try compile a C++ project that was created in VS 2008 using VS 2010, you get the following error:

C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppBuild.targets(292,5): error MSB8009: .NET Framework 2.0/3.0/3.5 target the v90 platform toolset. Please make sure that Visual Studio 2008 is installed on the machine. [C:\dev\YourCPPProject.vcxproj]

It turns out that there are two places you have to change.

  1. Update the platform toolset from v90 to v100
  2. Update the target framework from v3.5 to to v4.0

Updating the platform toolset can be done in Visual Studio 2010.

  1. Right click on your C++ project (vcxproj) in Solution Explorer
  2. Select Properties
  3. Under “Configuration Properties” node, select “General”.
  4. You should see a property section call “Platform Toolset”, change it to v100.


Here is the part that I don’t understand why VS 2010 doesn’t have or implement such feature: How to change the target framework? Guess what, you have to do it manually.

  1. To update from .NET 3.5 to 4.0:
  2. manually open the .vcxproj file in Notepad (or I use Notepad++)
  3. Look for the xml tag <TargetFrameworkVersion>
  4. Update it to v4.0

By the way, you could also change the PlatformToolset manually too.

Once Visual Studio reload the project, your C++ should now be compiled using .NET 4.0 with the proper toolset.