VS 2012 and later writing XP-compatible exe

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

 

Using VS 2012 and later compile and execute a program (exe) on Win 10, into the "not a valid win32 application" error running XP system will appear. This is because the compiler writes the minimum system requirements version in the program head, I think that XP can not be performed.

By VS command-line tool, call editbin issue the following command:

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

Where $ (the TargetPath) specified for file output VS exe macro location may be the actual path of the program.

VS noticed editbin program is located in the tool folder, you can configure exe project properties, in the "generating event" - "Post-build event command line" call instruction is written:

"$(DevEnvDir)\..\Tools\VsDevCmd.bat"
editbin.exe "$(TargetPath)" /SUBSYSTEM:WINDOWS,5.01 /OSVERSION:5.1

Wherein the first row is used to enable VS command line environment, including the VS Tools folder contains the default path environment variable.

Guess you like

Origin www.cnblogs.com/heroius/p/11226810.html