Share via


Specifying Custom Build Rules

Home Page (Projects)OverviewsHow Do I... TopicsNMAKE Reference

When creating a custom build rule using a custom batch file, prepend the batch file with "call" to insure that all custom build rules following that rule will be executed.

When custom build rules create or incorporate files that are foreign to the current project or require a dependency relationship, click Dependencies on the Custom Build tab to identify these dependencies.

To specify custom build rules

  1. In the Project Settings dialog box, use the Settings For pane to select the source files or output files from project configurations for which you want to specify a custom rule or rules.

    By default, a number of file types have rules associated with them, such as .c or .cpp files in Visual C++. You cannot specify a custom rule for these files. If you select files of this type, the Custom Build tab becomes unavailable.

  2. Select the Custom Build tab.

    If you have made multiple selections, the Input File text specifies multiple selections.

  3. In the Description text box, type a description.

  4. In the Build Command(s) list, select the first line, and type the command that you want to run on the input file.

    If you type more than one command in the grid, the build process runs them in order, from top to bottom.

    Note   The command must include all required options. You may want to use a directory macro to specify the location for the output file.

  5. In the Output File(s) list, select the first line, and type the name of an output file that is created by the build commands specified in the Build Commands grid.

    If the commands create more than one output file, type additional names in the subsequent lines of the grid.

What do you want to know more about?

Customizing a build process

Macros for custom build commands

What do you want to do?

Select the directories for the output files

Specify Input dependencies

Specify build rules that run before the link process

Specify build rules that run after the build process