Specifying Build Events
For the latest documentation on Visual Studio 2017 RC, see Visual Studio 2017 RC Documentation.
You can use build events to specify commands that run before the build starts, before the link process, or after the build finishes.
Build events are executed only if the build successfully reaches those points in the build process. If an error occurs in the build, the post-build event will not occur; if the error occurs before the linking phase, neither the pre-link nor the post-build event will occur. Additionally, if no files need to be linked, the pre-link event will not occur. The pre-link event is also not available in projects that do not contain a link step.
If no files need to be built, no build events will occur.
For general information on build events, see Understanding Custom Build Steps and Build Events.
In Solution Explorer, select the project for which you want to specify the build event.
Open the project's Property Pages dialog box. For more information, see Working with Project Properties.
In the Build Events folder, select a build event property page.
Specify the properties associated with the build event:
In Command Line, specify a command as if you were specifying it at the command prompt. Specify a valid command or batch file, and any required input or output files. Specify the call batch command before the name of a batch file to guarantee that all subsequent commands are executed.
Multiple input and output files can be specified symbolically with MSBuild macros. For more information about specifying the location of files, or the names of sets of files, see Common Macros for Build Commands and Properties.
Because the '%' character is reserved by MSBuild, if you specify an environment variable replace each % escape character with the %25 hexadecimal escape sequence. For example, replace %WINDIR% with %25WINDIR%25. MSBuild replaces each %25 sequence with the % character before it accesses the environment variable.
In Description, type a description for this event. The description will be printed to the Output window when this event occurs.
In Excluded From Build, specify Yes if you do not want the event to run.