Visual Studio 2019: How to use Platform Toolset v140_xp?
Asked Answered
P

3

5

I am trying to compile an application for Windows XP using Visual Studio 2019. For that I tried to use platform toolset v140_xp. It does not work, the following error message appears:

C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Platforms\Win32\PlatformToolsets\v140_xp\Toolset.targets(36,5): warning MSB8003: Could not find WindowsSdkDir_71A variable from the registry.  TargetFrameworkVersion or PlatformToolset may be set to an invalid version number.
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppBuild.targets(366,5): warning MSB8003: Could not find WindowsSDKDir variable from the registry.  TargetFrameworkVersion or PlatformToolset may be set to an invalid version number.

Clearly, the tools are looking for the Windows SDK v7.1A. Downloading the Windows 7 SDK from Microsoft does not work. Even if you manage to install it, the SDK has version 7.1 (without the A) and not 7.1A. So the error remains.

I have found out that the Windows SDK v7.1A used to be included with Visual Studio 2015, but I cannot find it anywhere in the Visual Studio 2019 installer.

How do I use the v140_xp toolset?

Steps to reproduce the problem:

  • install Visual Studio 2019 with desktop c++ development
  • select "MSVC v140 - VS2015 C++ Build tools" in the visual studio 2019 installer
  • create a C++ console application project
  • edit the project settings
  • select the v140_xp platform toolset
  • try to build the project
Picture answered 7/11, 2019 at 19:18 Comment(0)
P
10

In the Visual Studio 2019 Installer, the Windows SDK 7.1A is hidden behind the option "C++ Windows XP Support for VS 2017 (v141) tools [Deprecated]".

Hovering the mouse over that option a tooltip appears that states that Windows SDK 7.1 is included with that component.

The whole procedure is described here: https://learn.microsoft.com/en-us/cpp/build/configuring-programs-for-windows-xp?view=vs-2019

Picture answered 7/11, 2019 at 19:18 Comment(0)
A
9

Updated for someone who will be confused by installer GUI like me.

There are "Individual Components" tab on the top, and "Individual Components" check list on the left.

Checking "C++ Desktop Development" does not trigger all C++ components to appear in check list. "WinXP support" must be checked in tab first, and then it appears in check list:

enter image description here

See also: https://github.com/MicrosoftDocs/cpp-docs/issues/1810

Apollinaire answered 15/3, 2020 at 10:1 Comment(6)
What issue do you have with my answer? The option "C++ Windows XP for VS2017 (v141) [deprecated]" is still available in the VS2019 installer and it works. I tested a small Hello World program.Picture
@Sven: The first screenshot in my post is from VS2019 Installer - there's no such option. 140 and 141 toolsets are available, but not 140_xp or 141_xp. It's Enterprise edition in my case. Actually, I found your answer, and for some time tried to understand, what am I doing wrong, and where is this option. :) Maybe, it depends on VS installer version/edition/or something else.Apollinaire
I have 16.4.5 and it's still there for me. Not sure if it's a matter of "version", or "already having the thing installed to begin with".Delanie
learn.microsoft.com/en-us/cpp/build/… According to the link you have to install "C++ Windows XP Support for VS 2017 (v141) tools [Deprecated]"Picture
I just upgraded to Visual Studio 2019 16.5.0 Community edition and the option is still there.Picture
@Sven: the problem was "where to find this checkbox". Updated answer.Apollinaire
M
0

using visual studio installer and install v140 and v141_xp

Marchelle answered 19/11, 2021 at 3:24 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.