English

Error: 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

Error Message

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”

Cause

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.

Solution or Workaround

  1. Open the VS2010 solution file.
  2. In the Solution Explorer, right-click on the project and select 'Properties'.
  3. On the left panel of the Property page, expand 'Configuration Properties' and select 'General'.
  4. On the right panel, change the value of Platform Toolset from v90 to v100 and click OK.
  5. In the Solution Explorer, open the 'StdAfx.h' file.
  6. Update the value of '_WIN32_WINNT' from 0x0400 to 0x0501, if applicable. It will be similar to the following example:

    Code:
    //#define _WIN32_WINNT 0x0400
    #define _WIN32_WINNT 0x0501

    Note:
    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”.
  7. Save and build the project.

    Warning:
    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\...'.


    Note:
    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.

Related Information