How to debug visual studio pre / post build events
Sometime you add pre/post build event to your project and the build event fails.
How can you spot what exactly caused the fail?
There are several way to spot the error :
1. Use 'rem' to mark a line as remark like you used to do in dos batch files and spot the line with the error
2. Use redirection to a file meaning add '> mydebuginfo.txt' and search for that file in the bin\debug directory.
inside this fill you will find the error which caused the build to fail.
A much nicer and easier way would be to get the error in a message box, don't you think ?
1. Download Frank Westlake Popup utility (Batch file message box which can take pipe input)
2. Put popup.exe somewhere in your path (ie. c:\windows )
2. Add pipe redirection at the end of the line the suspicious line ' | popup'
and you'll get a message box describing the error.
Another way is to check the bin\debug dir for 'PreBuildEvent.bat' or 'PostBuildEvent.bat' which are the file that Visual Studio creates and run during the build events, if there is an error the files remain in the output dir and you can run them manually and spot the error.