It’s because Visual Studio seems to copy an x86 version of the VC++ runtime into system32 on ARM64 systems. That’ll make it crash with a bad image format error. If you copy the ARM64 version of vcruntime140.dll
(for me, found in C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Redist\MSVC\14.28.29325\arm64\Microsoft.VC142.CRT
) into the build directory, binaries will work.
Two-year anniversary! Visual Studio 2022 (17.4.3) on ARM64 now works with Release builds, but fails with Debug builds. It seems that the vcruntime DLLs work fine, but now ucrtbased.dll is broken. Here is a path to get the debug DLL: `C:\Program Files (x86)\Windows Kits\10\bin\10.0.20348.0\arm64\ucrt\ucrtbased.dll“` . Copy into the build directory to try; copy to `C:\Windows\System32` to fix all programs.