Skip to content

Repo sync for protected CLA branch #3788

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,40 +1,42 @@
---
description: "Learn more about: Formatting the Output of a Custom Build Step or Build Event"
title: "Formatting the Output of a Custom Build Step or Build Event"
ms.date: "08/27/2018"
description: "Learn more about: Formatting the output of a custom build step or build event"
title: "Formatting the output of a custom build step or build event"
ms.date: 03/15/2022
helpviewer_keywords: ["builds [C++], build events", "custom build steps [C++], output format", "events [C++], build", "build events [C++], output format", "build steps [C++], output format", "builds [C++], custom build steps"]
ms.assetid: 92ad3e38-24d7-4b89-90e6-5a16f5f998da
---
# Formatting the Output of a Custom Build Step or Build Event
# Formatting the output of a custom build step or build event

If the output of a custom build step or build event is formatted correctly, users get the following benefits:

- Warnings and errors are counted in the **Output** window.

- Output appears in the **Task List** window.

- Clicking on the output in the **Output** window displays the appropriate topic.
- Clicking on the output in the **Output** window displays the appropriate location.

- F1 operations are enabled in the **Task List** window or **Output** window.
- **F1** operations are enabled in the **Task List** window or **Output** window.

## Output format

The format of the output should be:

> {<em>filename</em>**(**<em>line#</em> \[**,** <em>column#</em>]**)** \| *toolname*} **:** \[ <em>any text</em> ] {**error** \| **warning**} <em>code+number</em>**:**<em>localizable string</em> \[ <em>any text</em> ]
> { *filename*`(`*line-number* \[`,` *column-number*]`)` \| *tool-name* } `:` \[ *any-text* ] {`error` \| `warning`} *code-type-and-number* `:` *localizable-string* \[ *any-text* ]

Where:

- {*a* \| *b*} is a choice of either *a* or *b*.
- { *a* \| *b* } is a choice of either *a* or *b*,

- \[<em>item</em>] is an optional string or parameter.
- \[ *item* ] is an optional string or parameter,

- **Bold** represents a literal.
- `text` represents a literal.

For example:

> C:\\*sourcefile.cpp*(134) : error C2143: syntax error : missing ';' before '}'
> C:\\sourcefile.cpp(134) : error C2143: syntax error : missing ';' before '}'
>
> LINK : fatal error LNK1104: cannot open file '*somelib.lib*'
> LINK : fatal error LNK1104: cannot open file 'some-library.lib'

## See also

[Understanding Custom Build Steps and Build Events](understanding-custom-build-steps-and-build-events.md)
[Understanding custom build steps and build events](understanding-custom-build-steps-and-build-events.md)
34 changes: 19 additions & 15 deletions docs/build/how-to-add-custom-build-tools-to-msbuild-projects.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,27 @@
---
description: "Learn more about: How to: Add Custom Build Tools to MSBuild Projects"
title: "How to: Add Custom Build Tools to MSBuild Projects"
ms.date: "11/04/2016"
description: "Learn more about how to add custom build tools to MSBuild projects"
title: "How to: Add custom build tools to MSBuild projects"
ms.date: 03/15/2022
helpviewer_keywords: ["msbuild (c++), howto: add custom build tools"]
ms.assetid: de03899a-371d-4396-9bf9-34f45a65e909
---
# How to: Add Custom Build Tools to MSBuild Projects
# How to: Add custom build tools to MSBuild projects

A custom build tool is a user-defined, command-line tool that is associated with a particular file.
A custom build tool is a user-defined, command-line tool that's associated with a particular file.

For a particular file, specify in the project file (.vcxproj) the command line to execute, any additional input or output files, and a message to display. If **MSBuild** determines that your output files are out of date with regard to your input files, it displays the message and executes the command-line tool.
For a particular file, specify in the project file (*`.vcxproj`*) the command line to execute, any other input or output files, and a message to display. If **MSBuild** determines that your output files are out of date relative to your input files, it displays the message and executes the command-line tool.

To specify when the custom build tool executes, use one or both of the `CustomBuildBeforeTargets` and `CustomBuildAfterTargets` XML elements in the project file. For example, you might specify that your custom build tool run after the MIDL compiler and before the C/C++ compiler. Specify the `CustomBuildBeforeTargets` element to execute the tool before a particular target runs; the `CustomBuildAfterTargets` element to execute the tool after a particular target; or both elements to run the tool between execution of two targets. If neither element is specified, your custom build tool executes at its default location, which is before the **MIDL** target.
## Specify custom build tools and custom build steps

To specify when the custom build tool executes, use one or both of the `CustomBuildBeforeTargets` and `CustomBuildAfterTargets` XML elements in the project file. For example, you might specify that your custom build tool run after the MIDL compiler and before the C/C++ compiler. Specify the `CustomBuildBeforeTargets` element to execute the tool before a particular target runs. Use the `CustomBuildAfterTargets` element to execute the tool after a particular target runs. Use both elements to run the tool between execution of two targets. If neither element is specified, your custom build tool executes at its default location, which is before the **MIDL** target.

Custom build steps and custom build tools share the information specified in the `CustomBuildBeforeTargets` and `CustomBuildAfterTargets` XML elements. Specify those targets one time in your project file.

### To add a custom build tool

1. Add an item group to the project file and add an item for each input file. Specify the command, additional inputs, outputs, and a message as item metadata, as shown here. This example assumes that a "faq.txt" file exists in the same directory as your project.
1. Add an item group to the project file and add an item for each input file. Specify the command and its inputs, outputs, and a message as item metadata, as shown here. This example assumes that a "faq.txt" file exists in the same directory as your project. The custom build step copies it to the output directory.

```
```xml
<ItemGroup>
<CustomBuild Include="faq.txt">
<Message>Copying readme...</Message>
Expand All @@ -29,11 +31,11 @@ Custom build steps and custom build tools share the information specified in the
</ItemGroup>
```

### To define where in the build the custom build tools will execute
### To define where in the build the custom build tools execute

1. Add the following property group to the project file. You have to specify at least one of the targets, but you can omit the other if you are only interested in having your build step execute before (or after) a particular target. This example performs the custom step after compiling but before linking.
1. Add the following property group to the project file. You have to specify at least one of the targets. You can omit the other if you're only interested in having your build step execute before (or after) a particular target. This example performs the custom step after compiling but before linking.

```
```xml
<PropertyGroup>
<CustomBuildAfterTargets>ClCompile</CustomBuildAfterTargets>
<CustomBuildBeforeTargets>Link</CustomBuildBeforeTargets>
Expand All @@ -42,6 +44,8 @@ Custom build steps and custom build tools share the information specified in the

## See also

[Walkthrough: Using MSBuild to Create a C++ Project](walkthrough-using-msbuild-to-create-a-visual-cpp-project.md)<br/>
[How to: Use Build Events in MSBuild Projects](how-to-use-build-events-in-msbuild-projects.md)<br/>
[How to: Add a Custom Build Step to MSBuild Projects](how-to-add-a-custom-build-step-to-msbuild-projects.md)
[Walkthrough: Using MSBuild to create a C++ project](walkthrough-using-msbuild-to-create-a-visual-cpp-project.md)\
[How to: Use build events in MSBuild projects](how-to-use-build-events-in-msbuild-projects.md)\
[How to: Add a custom build step to MSBuild projects](how-to-add-a-custom-build-step-to-msbuild-projects.md)\
[Common macros for MSBuild commands and properties](reference/common-macros-for-build-commands-and-properties.md)\
[MSBuild well-known item metadata](/visualstudio/msbuild/msbuild-well-known-item-metadata)
64 changes: 34 additions & 30 deletions docs/build/reference/bscmake-options.md
Original file line number Diff line number Diff line change
@@ -1,68 +1,72 @@
---
title: "BSCMAKE Options"
title: "BSCMAKE options"
description: "Reference to the Microsoft BSCMAKE utility command-line options."
ms.date: "02/09/2020"
ms.date: 03/21/2022
f1_keywords: ["VC.Project.VCBscMakeTool.OutputFile", "VC.Project.VCBscMakeTool.SuppressStartupBanner", "VC.Project.VCBscMakeTool.PreserveSBR"]
helpviewer_keywords: ["/v BSCMAKE option", "Iu BSCMAKE option", "browse information files (.bsc), content", "/Er BSCMAKE option", "NOLOGO BSCMAKE option", "/s BSCMAKE option", "/Ei BSCMAKE option", "/o BSCMAKE option", "/NOLOGO BSCMAKE option", "/Iu BSCMAKE option", "s BSCMAKE option (/s)", "/Em BSCMAKE option", "Em BSCMAKE option", "Es BSCMAKE option", "files [C++], BSCMAKE", "Er BSCMAKE option", "BSCMAKE, options for controlling files", "controlling BSCMAKE options", "El BSCMAKE option", "/El BSCMAKE option", "/Es BSCMAKE option", "Ei BSCMAKE option"]
ms.assetid: fa2f1e06-c684-41cf-80dd-6a554835ebd2
---
# BSCMAKE Options
# BSCMAKE options

> [!WARNING]
> Although BSCMAKE is still installed with Visual Studio, it is no longer used by the IDE. Since Visual Studio 2008, browse and symbol information is stored automatically in a SQL Server *`.sdf`* file in the solution folder.
> Although BSCMAKE is still installed with Visual Studio, it's no longer used by the IDE. Since Visual Studio 2008, browse and symbol information is stored automatically in a SQL Server *`.sdf`* file in the solution folder.

This section describes the options available for controlling BSCMAKE. Several options control the content of the browse information file by excluding or including certain information. The exclusion options can allow BSCMAKE to run faster and may result in a smaller *`.bsc`* file. Option names are case-sensitive (except for **/HELP** and **/NOLOGO**).
This section describes the options available for controlling BSCMAKE. Several options control the content of the browse information file by excluding or including certain information. The exclusion options can allow BSCMAKE to run faster and may result in a smaller *`.bsc`* file. Option names are case-sensitive (except for **`/HELP`** and **`/NOLOGO`**).

Only **/NOLOGO** and **/o** are available from within the Visual Studio development environment. See [Set C++ compiler and build properties in Visual Studio](../working-with-project-properties.md) for information on access a project's property pages.
Only **`/NOLOGO`** and **`/o`** are available from within the Visual Studio development environment. For more information, see [Set C++ compiler and build properties in Visual Studio](../working-with-project-properties.md).

**/Ei (**_filename_...**)**\
Excludes the contents of the specified include files from the browse information file. To specify multiple files, separate the names with a space and enclose the list in parentheses. Parentheses aren't necessary if you specify only one *filename*. Use **/Ei** along with the **/Es** option to exclude files not excluded by **/Es**.
## Options

**/El**\
**`/Ei (`** *`filename`* ... **`)`**\
Excludes the contents of one or more specified *`filename`* include files from the browse information file. To specify multiple files, separate the names with a space and enclose the list in parentheses. Parentheses aren't necessary if you specify only one *`filename`*. Use **`/Ei`** along with the **`/Es`** option to exclude files not excluded by **`/Es`**.

**`/El`**\
Excludes local symbols. The default is to include local symbols. For more information about local symbols, see [Creating an .sbr File](creating-an-dot-sbr-file.md).

**/Em**\
Excludes symbols in the body of macros. Use **/Em** to include only the names of macros in the browse information file. The default is to include both the macro names and the result of the macro expansions.
**`/Em`**\
Excludes symbols in the body of macros. Use **`/Em`** to include only the names of macros in the browse information file. The default is to include both the macro names and the result of the macro expansions.

**/Er (**_symbol_...**)**\
Excludes the specified symbols from the browse information file. To specify multiple symbol names, separate the names with a space and enclose the list in parentheses. Parentheses are unnecessary if you specify only one *symbol*.
**`/Er (`** *`symbol`* ... **`)`**\
Excludes one or more of the specified *`symbol`* symbols from the browse information file. To specify multiple symbol names, separate the names with a space and enclose the list in parentheses. Parentheses are unnecessary if you specify only one *`symbol`*.

**/Es**\
Excludes every include file specified with an absolute path, or found in an absolute path specified in the INCLUDE environment variable. (Usually, these files are the system include files, which contain much information you may not need in your browse information file.) This option doesn't exclude files specified without a path, or with relative paths, or files found in a relative path in INCLUDE. You can use the **/Ei** option along with **/Es** to exclude files that **/Es** doesn't exclude. If you want to exclude only some of the files, use **/Ei** instead of **/Es**, and list the files you want to exclude.
**`/Es`**\
Excludes every include file specified with an absolute path, or found in an absolute path specified in the INCLUDE environment variable. (Usually, these files are the system include files, which contain much information you may not need in your browse information file.) This option doesn't exclude files specified without a path, or with relative paths, or files found in a relative path in INCLUDE. You can use the **`/Ei`** option along with **`/Es`** to exclude files that **`/Es`** doesn't exclude. If you want to exclude only some of the files, use **`/Ei`** instead of **`/Es`**, and list the files you want to exclude.

**/errorreport:**[**none** \| **prompt** \| **queue** \| **send**]\
This option is deprecated. Starting in Windows Vista, error reporting is controlled by [Windows Error Reporting (WER)](/windows/win32/wer/windows-error-reporting) settings.
**`/errorreport:`**\[ **`none`** \| **`prompt`** \| **`queue`** \| **`send`** ]\
This option is deprecated. In Windows Vista and later, error reporting is controlled by [Windows Error Reporting (WER)](/windows/win32/wer/windows-error-reporting) settings.

**/HELP**\
**`/HELP`**\
Displays a summary of the BSCMAKE command-line syntax.

**/Iu**\
**`/Iu`**\
Includes unreferenced symbols. By default, BSCMAKE doesn't record any symbols that are defined but not referenced. If an *`.sbr`* file has been packed, this option has no effect for that input file because the compiler has already removed the unreferenced symbols.

**/n**\
Forces a nonincremental build. Use **/n** to force a full build of the browse information file whether a *`.bsc`* file exists or not, and to prevent *`.sbr`* files from being truncated. For more information, see [How BSCMAKE builds a `.bsc` file](how-bscmake-builds-a-dot-bsc-file.md).
**`/n`**\
Forces a non-incremental build. Use **`/n`** to force a full build of the browse information file whether a *`.bsc`* file exists or not, and to prevent *`.sbr`* files from being truncated. For more information, see [How BSCMAKE builds a `.bsc` file](how-bscmake-builds-a-dot-bsc-file.md).

**/NOLOGO**\
**`/NOLOGO`**\
Suppresses the BSCMAKE copyright message.

**/o** *filename*\
Specifies a name for the browse information file. By default, BSCMAKE gives the browse information file the base name of the first *`.sbr`* file and a *`.bsc`* extension.
**`/o`** *`filename`*\
The *`filename`* option parameter specifies a name for the browse information file. By default, BSCMAKE gives the browse information file the base name of the first *`.sbr`* file and a *`.bsc`* extension.

**/S (**_filename_...**)**\
Tells BSCMAKE to process the specified include file the first time it's encountered and to exclude it otherwise. Use this option to save processing time when a file (such as a header, or *`.h`*, file for a *`.c`* or *`.cpp`* source file) is included in several source files but is unchanged by preprocessing directives each time. Use this option if a file is changed in ways unimportant for the browse information file you're creating. To specify multiple files, separate the names with a space, and enclose the list in parentheses. Parentheses aren't necessary if you specify only one *filename*. If you want to exclude the file every time it's included, use the **/Ei** or **/Es** option.
**`/S (`** *`filename`* ... **`)`**\
Tells BSCMAKE to process each specified *`filename`* include file the first time it's encountered and to exclude it otherwise. Use this option to save processing time when a file (such as a header, or *`.h`*, file for a *`.c`* or *`.cpp`* source file) is included in several source files but is unchanged by preprocessing directives each time. Use this option if a file is changed in ways unimportant for the browse information file you're creating. To specify multiple files, separate the names with a space, and enclose the list in parentheses. Parentheses aren't necessary if you specify only one *`filename`*. If you want to exclude the file every time it's included, use the **`/Ei`** or **`/Es`** option.

**/v**\
**`/v`**\
Provides verbose output, which includes the name of each *`.sbr`* file being processed and information about the complete BSCMAKE run.

**/?**\
**`/?`**\
Displays a brief summary of BSCMAKE command-line syntax.

The following command line tells BSCMAKE to do a full build of MAIN.bsc from three *`.sbr`* files. It also tells BSCMAKE to exclude duplicate instances of TOOLBOX.h:
## Example

The following command line tells BSCMAKE to do a full build of *`main.bsc`* from three *`.sbr`* files. It also tells BSCMAKE to exclude duplicate instances of *`toolbox.h`*:

```cmd
BSCMAKE /n /S toolbox.h /o main.bsc file1.sbr file2.sbr file3.sbr
```

## See also

[BSCMAKE Reference](bscmake-reference.md)
[BSCMAKE reference](bscmake-reference.md)
Loading