Visual Studio pre-build event; Checking exit code for each event -
i have solution multiple projects. 1 project needs build if both 2 events, in pre-build event, exit error code 0.
so thought following:
"c:\path\to\binary1.exe" & "c:\path\to\binary2.exe"
in test scenario goes wrong binary1.exe exits non-zero value. visual studio goes on building project anyway. when run pre-build event commandline in cmd , echo %errorlevel% see exit code being non-zero.
when put
"c:\path\to\binary1.exe"
in pre-build event, build stopped , en error shown in error list
window of visual studio.
i sure binary1.exe exiting non-zero value shows messagebox prior exit.
i can think of 1 solution. binary1.exe calling binary2.exe , exiting non-zero exit code when binary2.exe exits non-zero exit code. not flexible solution.
to summarize: how can run multiple pre-build events , stop buidling when 1 of commands returns non-zero value?
i think yuou can follows:
run command 1 if errorlevel 1 ( exit /b 1 ) run command 2
Comments
Post a Comment