VS2017 的 x64 和 ARM 开发人员提示在哪里?

Posted

技术标签:

【中文标题】VS2017 的 x64 和 ARM 开发人员提示在哪里?【英文标题】:Where are the x64 and ARM Developer Prompts for VS2017? 【发布时间】:2017-05-31 23:35:23 【问题描述】:

我安装了 Visual Studio 2017 构建工具。安装后,导航开始 → 程序 → Visual Studio 2017 → Visual Studio Tools 时只有一个 x86 开发人员命令提示符。 x64 和 ARM 没有提示。 (通常有大约 6 个开发者提示可供选择)。

x64 和 ARM 的构建工具在哪里?


更新(2017 年 1 月 18 日)

按照@magicandre1981 说明安装整个 Windows 10 SDK、Build 15003 后,我找不到开发人员提示。我在“开始”菜单中找不到它们;并放入 Git Bash shell 并搜索它们会返回 0 个结果。

在下面的名称中,vsdevcmd.bat 是 2017 年 VC++ 构建工具安装的。vcbuildtools.bat 是 2015 年 VC++ 构建工具安装的。

MINGW64 /c/Program Files (x86)/Windows Kits/10
$ find . -iname 'vsdevcmd.*'

$ find . -iname 'vcbuildtools.*'

$ find . -iname '*.bat'

$ find . -iname '*.cmd'
./bin/10.0.15003.0/arm/SecureBoot/DeleteKitsPolicy.cmd
./bin/10.0.15003.0/arm/SecureBoot/InstallKitsPolicy.cmd
./bin/10.0.15003.0/arm64/install-sampleprovider.cmd
./bin/10.0.15003.0/arm64/uninstall-sampleprovider.cmd
./bin/10.0.15003.0/x64/install-sampleprovider.cmd
./bin/10.0.15003.0/x64/uninstall-sampleprovider.cmd
./bin/10.0.15003.0/x86/DismFoDInstall.cmd
./bin/10.0.15003.0/x86/GenerateUnionWinMD.cmd
./bin/10.0.15003.0/x86/install-sampleprovider.cmd
./bin/10.0.15003.0/x86/uninstall-sampleprovider.cmd
./bin/arm/SecureBoot/DeleteKitsPolicy.cmd
./bin/arm/SecureBoot/InstallKitsPolicy.cmd
./bin/arm64/install-sampleprovider.cmd
./bin/arm64/uninstall-sampleprovider.cmd
./bin/x64/install-sampleprovider.cmd
./bin/x64/uninstall-sampleprovider.cmd
./bin/x86/DismFoDInstall.cmd
./bin/x86/GenerateUnionWinMD.cmd
./bin/x86/install-sampleprovider.cmd
./bin/x86/uninstall-sampleprovider.cmd
./Debuggers/x64/srcsrv/cv2http.cmd
./Debuggers/x64/srcsrv/cvsindex.cmd
./Debuggers/x64/srcsrv/p4index.cmd
./Debuggers/x64/srcsrv/ssindex.cmd
./Debuggers/x64/srcsrv/svnindex.cmd
./Debuggers/x64/srcsrv/tfsindex.cmd
./Debuggers/x64/srcsrv/vssindex.cmd
./Debuggers/x64/srcsrv/walk.cmd
./Debuggers/x86/srcsrv/cv2http.cmd
./Debuggers/x86/srcsrv/cvsindex.cmd
./Debuggers/x86/srcsrv/p4index.cmd
./Debuggers/x86/srcsrv/ssindex.cmd
./Debuggers/x86/srcsrv/svnindex.cmd
./Debuggers/x86/srcsrv/tfsindex.cmd
./Debuggers/x86/srcsrv/vssindex.cmd
./Debuggers/x86/srcsrv/walk.cmd
./Windows Performance Toolkit/gpuview/log.cmd
./Windows Performance Toolkit/gpuview/log_mem.cmd
./Windows Performance Toolkit/WdfPerfEnhancedVerifier.cmd

$

出于绝望,我复制了 2017 Build Tools Developer Prompt (for x86),并像 2015 build tools 一样添加了amd64_arm。它导致失败:

[ERROR:parse_cmd.bat] Invalid command line argument: 'amd64_arm'. Argument will
be ignored.
**********************************************************************
** Visual Studio 2017 RC Developer Command Prompt v15.0
** Copyright (c) 2016 Microsoft Corporation
**********************************************************************
[ERROR:VsDevCmd.bat] *** VsDevCmd.bat encountered errors. Environment may be inc
omplete and/or incorrect. ***

C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools>

更绝望...我开始追踪msiexec installers using process monitor和examining MSI contents using 7-zip。我能说的最好的是,即使在开发者工具 MSI 安装程序中,也没有开发者提示:

【问题讨论】:

我已经更新了我的答案,其中包含使用 VS2017 15.4 和 Win10 16299 SDK 为 ARM/ARM64 编译桌面应用程序的步骤 【参考方案1】:

开发人员提示 bat 文件似乎在 VS 2017 中进行了一些重组。您现在可以对其进行更多自定义,而不是拥有一组固定的预定义开发人员提示。

要获得开发人员提示,例如arm,将-arch=arm -host_arch=amd64 作为参数添加到VsDevCmd.bat(例如在开始菜单的快捷方式中)。

有关可用选项的完整列表,请查看\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\Tools\vsdevcmd\core\parse_cmd.bat,或致电"\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\Tools\vsdevcmd" -help

我不确定这是否真的记录在任何地方,或者是否会为 VS 2017 的最终版本修复和/或更好地记录。

安装 Insider Preview Windows 10 SDK 与此无关;独立的 Windows SDK 不包含任何编译器,仅包含头文件和链接库。

【讨论】:

为节省时间,-arch 选项为:x86amd64arm 除了 arm 似乎不起作用:vsdevcmd -arch=arm 导致 ERROR: Invalid host architecture 'arm'. 即使您使用 ARM 工具安装了最新的 (15063) Windows 10 SDK。 您是否也添加了-host_arch=amd64?否则它可能会认为您希望拥有与目标相同的主机工具架构。 @mstorsjo,问题是如果你尝试添加-host_arch=amd64,那么你最终会得到 amd64 目标。换句话说,cl /? 报告Microsoft (R) C/C++ Optimizing Compiler Version 19.10.25019 for x64,这意味着它针对 x86_64,而在使用 VS2015 ARM 提示时,相同的命令报告Microsoft (R) C/C++ Optimizing Compiler Version 19.00.24215.1 for ARM。此外,缺少C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.10.25017\bin\HostX86\arm\cl.exe 清楚地表明在 VS2017 中 NO ARM 交叉编译支持。 在 VS2017 中肯定有 ARM 交叉编译支持(我确实有你说缺少的确切 cl.exe),但你可能没有安装该部分 - 默认情况下未启用它。您需要在安装程序中打开“Individual components”选项卡并选中“Visual C++ compilers and libraries for ARM”框。见pasteboard.co/5uxpd08Yi.png。【参考方案2】:

安装 Windows 10 SDK 和 WDK(至少 Build 16299)以获取 ARM Compiler for Desktop Applications。

打开项目配置并创建 ARM(64) 配置:

如果你尝试编译它,你会得到一个错误,即桌面不支持 ARM64:

要解决此问题,请卸载项目并在编辑器中打开它,并将行 <WindowsSDKDesktopARM64Support>true</WindowsSDKDesktopARM64Support> 添加到 ARM64 的调试和发布条目中:

  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'" Label="Configuration">
    <ConfigurationType>Application</ConfigurationType>
    <UseDebugLibraries>true</UseDebugLibraries>
    <PlatformToolset>v141</PlatformToolset>
    <CharacterSet>Unicode</CharacterSet>
    <WindowsSDKDesktopARM64Support>true</WindowsSDKDesktopARM64Support>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'" Label="Configuration">
    <ConfigurationType>Application</ConfigurationType>
    <UseDebugLibraries>false</UseDebugLibraries>
    <PlatformToolset>v141</PlatformToolset>
    <WholeProgramOptimization>true</WholeProgramOptimization>
    <CharacterSet>Unicode</CharacterSet>
    <WindowsSDKDesktopARM64Support>true</WindowsSDKDesktopARM64Support>
  </PropertyGroup>

WindowsSDKDesktopARMSupport 用于 32 位 ARM。

保存更改,再次加载项目,现在编译工作正常:

15.9 Update for VS2017, adds official ARM64 support (only for UWP),这里打开ARM64开发提示的命令行是:

%comspec% /k ""C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat"" amd64_arm

32 位 Arm 命令行是:

%comspec% /k ""C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat"" x86_arm

【讨论】:

谢谢@magicandre1981。我无法在几个小时内对此进行测试,但我会回来的。您可以根据 arm64 应用程序 提出另外两个问题:Detect ARM-64 in preprocessor? 和 ARM SHA extensions and “error C3861: vsha1h_u32: identifier not found”。如果您不回答,那么我会为以后的访客回答。 再次感谢@magicandre1981。我无法下载。哦,好吧,这是一次不错的尝试...... 您可以毫无问题地加入内部计划。这是接下来 24 小时的 DL 链接:software-download.microsoft.com/pr/… 谢谢@magicandre1981。开发人员提示仍然没有乐趣。微软把这搞砸了...... 15 年来,我们用 Visual Studio 获得了开发工具,然后是构建工具。然后,在 2017 年,它被打破了。他们采取了一个简单的过程,并且打破了它,这绝对令人惊讶。一些白痴可能因此获得了丰厚的奖金。 好的,我没有安装c++工具,因为我没有使用VS2017,所以我看不到它是否真的有效:(

以上是关于VS2017 的 x64 和 ARM 开发人员提示在哪里?的主要内容,如果未能解决你的问题,请参考以下文章

vs2017添加引用报错

arm版win11运行vs2022

VS2012 x64 跨工具命令提示符

rc.exe 不再在 VS 2015 命令提示符中找到

vs2017 未能完成操作。不支持此接口

VS2010中开发人员工具语言包没有安装成功怎么办?