AddCustomBuildStep Method
Home Page (Objects) | Overview | FAQ | Reference
Applies to: Configuration object
Adds a custom build step to a specified configuration.
Syntax
object**.AddCustomBuildStep(command,** output**,** description )
Parameters
object
An expression that evaluates to a Configuration object.
command
A String containing commands that you want to execute after building the specified configuration. These commands correspond to those in the Build Commands(s) list on the Custom Build tab of the Project Settings dialog box (Project menu, Settings command) and are separated by commas.
output
A String specifying the files you want to create from this custom build step. These files correspond to those in the Outputs list on the Custom Build tab of the Project Settings dialog box (Project menu, Settings command). Each file name is separated by a newline character. (In VBScript use Chr(10) to represent a newline character.)
description
A String describing the purpose of this build step. This corresponds to the Description box on the Custom Build tab of the Project Settings dialog box (Project menu, Settings command) .
Remarks
The AddCustomBuildStep method runs after the specified configuration is built and applies to the entire configuration, not to a single file in the configuration.
Tip If you have a makefile project, you can also use this method to set the command line. If you are using this approach and you specify more than one command line or more than one output file, then only the first will be used. When using AddCustomBuildStep() on a makefile project, "command" becomes the command, "output" becomes the output, and "description" becomes the "rebuild all option."
Example
The following example includes a build step that copies an executable from a project's configuration to a specified directory after the executable is built:
Sub AddTargetCopyRule
If Projects(1).Type = "Build" Then
Projects(1).Configurations(1).AddCustomBuildStep "copy ""$(TargetPath)"" ""c:\MyOutDir""", _
"c:\MyOutDir\$(TargetName).exe", "Copy executable to c:\MyOutDir"
End If
End Sub