When compiling the Visual Studio (VS) 2010 version of any of the Visual C++ samples included in the ArcObjects SDK for the Microsoft .NET Framework, the following error may occur: “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”
This issue is a side effect of the Native C++ multi-targeting feature in Visual Studio 2010 in conjunction with an error in the way the VS2010 versions of the samples are produced.
Multi-targeting enables VS2008 toolsets to be built against from within the VS2010 environment, as long as VS2008 is installed on the same machine. This functionality is controlled through the Platform Toolset configuration property of a project. The value is set to v100 by default when targeting VS2010; it is set to v90 when targeting VS2008.
When opening a VC++ project created in VS2008 with VS2010, the conversion process automatically sets the Platform Toolset property to v90, if VS2008 is also installed on the same machine. Attempting to build the project on a machine that only has VS2010 installed, returns the above error. The Platform Toolset property must be set to v100 in order for a project to compile on a machine that only has VS2010 installed.
Unfortunately, the VS2010 versions of the Visual C++ samples included in the ArcObjects SDK for the Microsoft .NET Framework were created through the upgrade process described above. As a result, the Platform Toolset property must be modified so that the samples will compile on machines that are only running VS2010.
//#define _WIN32_WINNT 0x0400
#define _WIN32_WINNT 0x0501
The minimum system required Macros to define by Visual Studio 2010 is 0x0501 or greater. For details, see
Microsoft articles “Supported Platforms (Visual C++)” and “Using the Windows Headers”.
If a 64-bit machine is being used, additional build errors may be encountered. A common change that must be made when working on a 64-bit machine, is to update the OLB or CatIDs path from '\Program Files\ArcGIS\...' to '\Program Files (x86)\ArcGIS\...'.
Although the project should build successfully after making the changes described in the Solution above, red squiggles may still be visible under the '#import directive' in the 'StdAfx.h' file. This is a known issue with Visual Studio intellisense and should not affect the compilation of the project. See BugID 533526: “VC++ 2010 Intellisense #import directive using "libid" does not work” for more details on this known issue.
Get help from ArcGIS experts
Download the Esri Support App