Tuesday, September 2, 2008

Visual Studio custom build events

Custom build events in VS can be quite useful, but there are a few things to watch for.

1. Calling a batch file.... be sure to use the "call" command so you can add other processing after calling the batch file.

2. Error handling only looks at the last item (VS just blindly builds a batch file from the text you provide)

So here is my updated Custom Build Event

call $(SolutionDir)CustomBatchFile.bat $(SolutionDir) $(TargetDir)$(TargetFileName)
if errorlevel 1 goto Failed

xcopy /Y /F /R $(TargetDir)$(TargetFileName) z:\*.*
if errorlevel 1 goto Failed

exit 0

:Failed

exit 1

No comments:

chris' shared items

Twitter Updates

Official blog of Chris Lee Runyan

Fastest C++ in the west.