简体   繁体   中英

Post event build exit with code 1 error in Visual studio 2013

Here is the script:

copy /y "$(SolutionDir)Libs\Detect.dll" "$(SolutionDir)$(ConfigurationName)"
call editbin.exe /LARGEADDRESSAWARE SER.EXE > post.txt
call dumpbin.exe /HEADERS SER.EXE > post1.txt

The error is

Error 306 The command "copy /y "C:\\dev\\blah\\Libs\\Detect.dll" "C:\\dev\\blah\\Debug" call editbin.exe /LARGEADDRESSAWARE SER.EXE > post.txt call dumpbin.exe /HEADERS SER.EXE > post1.txt" exited with code 1.

Post event build exit with code 1 error in Visual studio 2013

Only one thing needs to be confirmed: Is this SER.EXE executed only in the release mode or just this SER.EXE is exist in the release folder and should be executed in the debug and release mode?

If this SER.EXE only need to be executed in the release , Lex`s suggestion should to be considered. Pre- and Post-Build Events run as a batch script. You can do a conditional statement on $(ConfigurationName). For example:

copy /y "$(SolutionDir)Libs\Detect.dll" "$(SolutionDir)$(ConfigurationName)"
if $(ConfigurationName) == Release call editbin.exe /LARGEADDRESSAWARE "SER.EXE"> post.txt
if $(ConfigurationName) == Release call dumpbin.exe /HEADERS SER.EXE > post1.txt

If this SER.EXE is exist in the release folder and should be executed in the debug and release mode , you just need to specify the release folder in the command:

 call editbin.exe /LARGEADDRESSAWARE "Release\SER.EXE"> post.txt
 call dumpbin.exe /HEADERS "Release\SER.EXE"> post1.txt

Obviously, you also need make sure the SER.EXE can be executed, you can use below command to test in the console application project:

call editbin.exe /LARGEADDRESSAWARE "$(TargetPath)"> post.txt

Note: When you want use this post-build event in both debug and release mode, you should add the command line for all configuration, Otherwise this command will only act on one mode (Just a reminder):

在此处输入图片说明

Hope this help.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM