簡體   English   中英

Visual Studio 2019:如何使用 Platform Toolset v140_xp?

[英]Visual Studio 2019: How to use Platform Toolset v140_xp?

我正在嘗試使用 Visual Studio 2019 為 Windows XP 編譯應用程序。為此,我嘗試使用平台工具集 v140_xp。 它不起作用,出現以下錯誤消息:

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.

顯然,這些工具正在尋找 Windows SDK v7.1A。 從 Microsoft 下載 Windows 7 SDK 不起作用。 即使您設法安裝它,SDK 也有 7.1 版(沒有 A)而不是 7.1A。 所以錯誤仍然存在。

我發現 Windows SDK v7.1A 曾經包含在 Visual Studio 2015 中,但我在 Visual Studio 2019 安裝程序的任何地方都找不到它。

如何使用 v140_xp 工具集?

重現問題的步驟:

  • 安裝 Visual Studio 2019 與桌面 c++ 開發
  • Visual Studio 2019 安裝程序中的 select “MSVC v140 - VS2015 C++ 構建工具”
  • 創建 C++ 控制台應用項目
  • 編輯項目設置
  • select v140_xp平台工具集
  • 嘗試構建項目

在 Visual Studio 2019 安裝程序中,Windows SDK 7.1A 隱藏在選項“C++ Windows XP 支持 [VS 2017]”后面

將鼠標懸停在該選項上會出現一個工具提示,指出 Windows SDK 7.1 包含在該組件中。

此處描述了整個過程: https://docs.microsoft.com/en-us/cpp/build/configuring-programs-for-windows-xp?view=vs-2019

為像我這樣會被安裝程序 GUI 混淆的人更新

頂部有“Individual Components”選項卡,左側有“Individual Components”檢查列表

檢查“C++ 桌面開發”不會觸發所有 C++ 組件出現在檢查列表中。 “WinXP support”必須先在標簽中勾選,然后才會出現在檢查列表中:

在此處輸入圖像描述

另請參閱: https://github.com/MicrosoftDocs/cpp-docs/issues/1810

使用 Visual Studio 安裝程序並安裝 v140 和 v141_xp

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM