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.
- Update the platform toolset from v90 to v100
- Update the target framework from v3.5 to to v4.0
Updating the platform toolset can be done in Visual Studio 2010.
- Right click on your C++ project (vcxproj) in Solution Explorer
- Select Properties
- Under “Configuration Properties” node, select “General”.
- 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.
- To update from .NET 3.5 to 4.0:
- manually open the .vcxproj file in Notepad (or I use Notepad++)
- Look for the xml tag <TargetFrameworkVersion>
- 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.