Build Arm64EC with Visual Studio 2022 Command Line
Install MSVC v143 ARM64 tools and Windows 11 SDK. Open the Arm64 Developer Command Prompt (vcvarsall arm64) then run cl /arm64EC and link /MACHINE:ARM64EC.
How do I build for Arm64EC with the Visual Studio 2022 command line?
I’m trying to build a “Hello, world” for Arm64EC using Visual Studio 2022 (following Microsoft’s docs). I don’t have an ‘Arm64 Developer Command Prompt’ in my Start menu - how do I install or enable it?
I found vcvarsamd64_arm64.bat and ran it, but the compiler ignores the /arm64ec option. Here’s my session:
C:\0>type hello.c
#include <stdio.h>
int main()
{
puts("Hello, ARM64EC");
return 0;
}
C:\0>"\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvarsamd64_arm64.bat"
**********************************************************************
** Visual Studio 2022 Developer Command Prompt v17.14.23
** Copyright (c) 2025 Microsoft Corporation
**********************************************************************
[vcvarsall.bat] Environment initialized for: 'x64_arm64'
C:\0>cl /O2 /arm64ec hello.c
Microsoft (R) C/C++ Optimizing Compiler Version 19.44.35222 for ARM64
Copyright (C) Microsoft Corporation. All rights reserved.
cl : Command line warning D9002 : ignoring unknown option '/arm64ec'
hello.c
Microsoft (R) Incremental Linker Version 14.44.35222.0
Copyright (C) Microsoft Corporation. All rights reserved.
/out:hello.exe
hello.obj
What is the correct way to set up the command-line environment and toolchain to compile for Arm64EC with Visual Studio 2022? Which Developer Command Prompt or vcvars*.bat should I run, and do I need to install specific Visual Studio workloads/components or updates to enable /arm64ec? How do I produce an Arm64EC executable from the command line (example commands and required compiler/linker switches)?
Install the MSVC v143 C++ ARM64 build tools and the latest Windows 11 SDK, then open an Arm64 Developer Command Prompt (for example run VsDevCmd.bat -arch=arm64 or vcvarsall.bat arm64) and build with cl /arm64EC and link /MACHINE:ARM64EC. The warning “ignoring unknown option ‘/arm64ec’” means you initialized the wrong environment (you used vcvarsamd64_arm64.bat which sets an x64→ARM64 cross environment), so switch to the ARM64 host environment and ensure the Arm64EC tools/SDK are installed in Visual Studio 2022.
Contents
- Prerequisites: Visual Studio 2022 and Windows 11 SDK for Arm64EC
- Install / enable Arm64EC tools in Visual Studio 2022
- Set up the Arm64 Developer Command Prompt (vsdevcmd / vcvarsall)
- Compile and link “Hello, world” for Arm64EC from the command line
- Why vcvarsamd64_arm64 made cl ignore /arm64EC
- Troubleshooting checklist
- Sources
- Conclusion
Prerequisites: Visual Studio 2022 and Windows 11 SDK for Arm64EC
Before you can build Arm64EC binaries you must have the right toolset and SDK. Install Visual Studio 2022 (version 17.3 or later) and the updated Windows 11 SDK that contains the Arm64EC headers/libs. The Microsoft Arm64EC doc lists these prerequisites and the exact flags you will use when compiling and linking: see the Arm64EC build guide for details (Windows 11 SDK + MSVC v143) https://learn.microsoft.com/en-us/windows/arm/arm64ec-build.
What to install (quick checklist)
- Visual Studio 2022 (update to latest release).
- Individual components: MSVC v143 - VS 2022 C++ ARM64 build tools (this is where the Arm64EC support lives).
- Windows 11 SDK (latest/insider build that includes Arm64EC support).
- Optional: C++ CMake tools if you build with CMake.
If you don’t see Arm64-related components in the Installer, run the Visual Studio Installer → Modify → Individual components and search for “ARM64” or “MSVC v143”.
Install / enable Arm64EC tools in Visual Studio 2022
Steps to add Arm64EC support
- Open the Visual Studio Installer and click Modify on your VS 2022 installation.
- Switch to the Individual components tab and search for “ARM64” or “MSVC v143”.
- Tick MSVC v143 - VS 2022 C++ ARM64 build tools (and install the latest Windows 11 SDK if not already present).
- Let the installer finish and reboot if prompted.
Microsoft’s blog and release notes also describe when ARM64 toolsets and Arm64EC support landed in VS 2022; if you’re on an older minor version, update to the latest VS 2022 channel before proceeding https://devblogs.microsoft.com/cppblog/arm64ec-support-in-visual-studio/.
Set up the Arm64 Developer Command Prompt (vsdevcmd / vcvarsall)
Which prompt to run?
- Use the ARM64 Developer Command Prompt (the “Arm64 Developer Command Prompt”) — that’s the environment that enables the Arm64EC switch. If it’s not in Start, launch it manually:
Example (exact paths may vary by SKU and install path):
"C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\Tools\VsDevCmd.bat" -arch=arm64
Or (legacy):
"C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvarsall.bat" arm64
(If you already have a Developer Command Prompt open, run vsdevcmd -arch=arm64 inside it.)
Important: do NOT use vcvarsamd64_arm64.bat if you intend to build with /arm64EC. That script initializes an x64→ARM64 cross environment (Environment initialized for: 'x64_arm64'). The Arm64EC compiler switch is recognized only when the toolchain is configured as the ARM64 host toolset (the Arm64 Developer Command Prompt).
Quick verification after starting the prompt:
- Run
where clto see which cl.exe you’re using. - Run
cl(orcl /?) and check that the toolchain path contains a HostARM64/arm64 path (or at least shows the ARM64 toolset).
See the MSVC command-line/initialization documentation for more options and script names https://learn.microsoft.com/en-us/cpp/build/building-on-the-command-line?view=msvc-170.
Compile and link “Hello, world” for Arm64EC from the command line
Once you’ve installed components and opened the correct (ARM64) prompt, the commands below will produce an Arm64EC executable.
Single-step compile+link:
cl /O2 /arm64EC hello.c /Fe:hello.exe
Separate compile + link (explicit):
cl /arm64EC /c hello.c :: produces hello.obj link /MACHINE:ARM64EC hello.obj /OUT:hello.exe
Notes:
- Use
/arm64ECto tell cl.exe to generate ARM64EC object code. - Use
/MACHINE:ARM64ECto tell the linker to produce an ARM64EC PE image. - If you get missing library errors at link time, confirm the Windows 11 SDK with Arm64EC libs is installed and that your environment variables (LIB, INCLUDE) point to the SDK paths.
If you use CMake: generate for the Visual Studio generator and platform ARM64, and add the compiler flags (e.g., -DCMAKE_C_FLAGS="/arm64EC"). The blog post and docs have more details for integrating with build systems https://devblogs.microsoft.com/cppblog/arm64ec-support-in-visual-studio/.
Why vcvarsamd64_arm64 made cl ignore /arm64EC
Short answer: wrong environment. vcvarsamd64_arm64.bat sets up an x64-host → ARM64-target cross environment (you’ll see “Environment initialized for: ‘x64_arm64’”). In that mode the active toolchain doesn’t expose the /arm64EC ABI switch, so the compiler warns ignoring unknown option '/arm64ec'. The Arm64EC ABI is supported when the toolchain is initialized for ARM64 host (the Arm64 Developer Command Prompt or vcvarsall.bat arm64); switch to that environment after you install the MSVC ARM64 build tools.
The C++ team explicitly calls this out: running /arm64EC from a non‑ARM64 environment will produce the “ignoring unknown option ‘/arm64ec’” warning because the toolchain isn’t set up for ARM64 https://devblogs.microsoft.com/cppblog/arm64ec-support-in-visual-studio/.
Troubleshooting checklist
If you still can’t build:
- Did you install MSVC v143 - VS 2022 C++ ARM64 build tools and the updated Windows 11 SDK? Re-run the Visual Studio Installer.
- Are you in the ARM64 Developer Command Prompt? Run
VsDevCmd.bat -arch=arm64orvcvarsall.bat arm64(notvcvarsamd64_arm64.bat). - Run
where cl— confirm the path points into an ARM64 toolset folder (HostARM64/arm64). - Run
cl /?— see whether/arm64ECappears recognized (or just trycl /arm64EC /c hello.cto test). - Link errors: make sure the LIB environment includes the Windows 11 SDK ARM64EC libraries.
- If the option still isn’t accepted, update Visual Studio to the newest 17.x release (Arm64EC support was added in 17.3+ and matured in later updates) and re-install the ARM64 tool components https://devblogs.microsoft.com/visualstudio/arm64-visual-studio/.
If you prefer hands-on reference, Microsoft’s Arm64EC build doc and the C++ team blog show the exact install and command-line snippets you can copy/paste: https://learn.microsoft.com/en-us/windows/arm/arm64ec-build and https://devblogs.microsoft.com/cppblog/arm64ec-support-in-visual-studio/.
Sources
- https://learn.microsoft.com/en-us/windows/arm/arm64ec-build
- https://devblogs.microsoft.com/cppblog/arm64ec-support-in-visual-studio/
- https://learn.microsoft.com/en-us/cpp/build/building-on-the-command-line?view=msvc-170
- https://devblogs.microsoft.com/visualstudio/arm64-visual-studio/
- http://www.emulators.com/docs/abc_arm64ec_explained.htm
Conclusion
To build for Arm64EC from the Visual Studio 2022 command line: install the MSVC v143 ARM64 tools and the proper Windows 11 SDK, open the Arm64 Developer Command Prompt (e.g., VsDevCmd.bat -arch=arm64 or vcvarsall.bat arm64), then compile with cl /arm64EC and link with link /MACHINE:ARM64EC. If you used vcvarsamd64_arm64.bat and saw the ignoring‑option warning, switch to the ARM64 host environment and re-run the build.