Troubleshooting Custom Build Steps and Build Events

If your custom build steps or events are not behaving as you expect, there are several things you can do to try to understand what is going wrong.

  • Make sure that the files your custom build steps generate match the files you declare as outputs.

  • If your custom build steps generate any files that are inputs or dependencies of other build steps (custom or otherwise), make sure that those files are added to your project.

  • Add @echo on as the first command to see what your custom build step is actually doing. The build events and build steps are placed in a temporary .bat file and run when the project is built, so, you can add error checking to your build event or build step commands.

  • Examine the build log (BuildLog.htm) in the intermediate files directory to see what actually executed.

    You can enable the build log by opening the Options dialog box (Tools menu) and then the VC++ Build property page in the Projects folder. Ensure that Build Logging is set to Yes.

  • Verify the values of any file-name or directory macros you are using. You can echo macros individually, or you can add copy %0 command.bat to the beginning of your custom build step, which will copy your custom build step's commands to command.bat with all macros expanded.

  • Run custom build steps and build events individually to check their behavior.

See Also

Reference

Understanding Custom Build Steps and Build Events