.net – Target .Net 3.5 in VS2010 for C++ executables

c++-clinetvisual studio 2010

Is it possible in VS2010 to create a mixed mode executable that targets .Net 3.5?

If we try this we get
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.

If we then change the toolset in the properties to v100, then the resulting executable still targets .Net 4.0.

If we would install VS2008, can we then still use the VS2010 compiler and the VS2010 CRT in our (native) C++ code when targeting .Net 3.5?

Best Answer

As explained in this answer, you need to add a TargetFrameworkVersion by manually editing the .vcxproj file.

I have VS2008 installed on that machine but I think I also selected to include the VC90 compilers when I installed 2010.

However, it appears it is not supported by design, according to this Microsoft response: targeting the 3.5 framework with the Visual C++ 2010 compiler is not supported. The Visual C++ 2010 compiler only supports targeting the 4.0 framework.