VS 2012 以及更高版本编写 XP 兼容 exe

https://stackoverflow.com/questions/12319952/how-do-i-target-net-4-0-3-on-xp-using-visual-studio-2012-application-fails-to

在Win 10 上使用VS 2012及更高版本编译执行程序(exe),放到 XP 系统运行会出现 “不是合法的win32应用程序” 错误。这是由于编译器在程序头中写入了最小系统版本要求,以至于XP认为无法执行。

通过VS命令行工具,调用 editbin 执行下述命令:

editbin.exe "$(TargetPath)" /SUBSYSTEM:WINDOWS,5.01 /OSVERSION:5.1

其中 $(TargetPath) 为VS宏指定的exe文件输出位置,也可以用实际的程序路径。

原文地址:https://www.cnblogs.com/heroius/p/11226810.html