Skip to content

Commit

Permalink
Merge pull request #10270 from rainersigwald/clarify-exec-regex
Browse files Browse the repository at this point in the history
MSBuild: Clarify exec regex behavior
  • Loading branch information
ghogen authored Jul 3, 2024
2 parents dbef5a3 + f4a34c3 commit 4d0b466
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions docs/msbuild/exec-task.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ The following table describes the parameters for the `Exec` task.
|`Command`|Required `String` parameter.<br /><br /> The command(s) to run. These can be system commands, such as attrib, or an executable, such as *program.exe*, *runprogram.bat*, or *setup.msi*.<br /><br /> This parameter can contain multiple lines of commands. Alternatively, you can put multiple commands in a batch file and run it by using this parameter.|
|`ConsoleOutput`|Optional <xref:Microsoft.Build.Framework.ITaskItem>`[]` output parameter.<br /><br /> Each item output is a line from the standard output or standard error stream emitted by the tool. This is only captured if `ConsoleToMsBuild` is set to `true`.|
|`ConsoleToMsBuild`|Optional `Boolean` parameter.<br /><br /> If `true`, the task will capture the standard error and standard output of the tool and make them available in the `ConsoleOutput` output parameter.<br /><br />Default: `false`.|
|`CustomErrorRegularExpression`|Optional `String` parameter.<br /><br /> Specifies a regular expression that is used to spot error lines in the tool output. This is useful for tools that produce unusually formatted output.<br /><br />Default: `null` (no custom processing).|
|`CustomWarningRegularExpression`|Optional `String` parameter.<br /><br /> Specifies a regular expression that is used to spot warning lines in the tool output. This is useful for tools that produce unusually formatted output.<br /><br />Default: `null` (no custom processing).|
|`CustomErrorRegularExpression`|Optional `String` parameter.<br /><br /> Specifies a regular expression that is used to spot error lines in the tool output. This is useful for tools that produce unusually formatted output.<br /><br />Unless `IgnoreStandardErrorWarningFormat` is specified, this regular expression is *in addition* to the [standard ones](./msbuild-diagnostic-format-for-tasks.md).<br /><br />Default: `null` (no custom processing).|
|`CustomWarningRegularExpression`|Optional `String` parameter.<br /><br /> Specifies a regular expression that is used to spot warning lines in the tool output. This is useful for tools that produce unusually formatted output.<br /><br />Unless `IgnoreStandardErrorWarningFormat` is specified, this regular expression is *in addition* to the [standard ones](./msbuild-diagnostic-format-for-tasks.md).<br /><br />Default: `null` (no custom processing).|
|`EchoOff`|Optional `Boolean` parameter.<br /><br /> If `true`, the task will not emit the expanded form of `Command` to the MSBuild log.<br /><br />Default: `false`.|
|`ExitCode`|Optional `Int32` output read-only parameter.<br /><br /> Specifies the exit code that is provided by the executed command, except that if the task logged any errors, but the process had an exit code of 0 (success), `ExitCode` is set to -1.|
|`IgnoreExitCode`|Optional `Boolean` parameter.<br /><br /> If `true`, the task ignores the exit code that is provided by the executed command. Otherwise, the task returns `false` if the executed command returns a non-zero exit code.<br /><br />Default: `false`.|
|`IgnoreStandardErrorWarningFormat`|Optional `Boolean` parameter.<br /><br /> If `false`, selects lines in the output that match the standard error/warning format, and logs them as errors/warnings. If `true`, disable this behavior.<br /><br />Default: `false`.|
|`IgnoreStandardErrorWarningFormat`|Optional `Boolean` parameter.<br /><br /> If `false`, selects lines in the output that match the [standard error/warning format](./msbuild-diagnostic-format-for-tasks.md), and logs them as errors/warnings. If `true`, disable this behavior.<br /><br />Default: `false`.|
|`Outputs`|Optional <xref:Microsoft.Build.Framework.ITaskItem>`[]` output parameter.<br /><br /> Contains the output items from the task. The `Exec` task does not set these itself. Instead, you can provide them as if it did set them, so that they can be used later in the project.|
|`StdErrEncoding`|Optional `String` output parameter.<br /><br /> Specifies the encoding of the captured task standard error stream. The default is the current console output encoding.|
|`StdOutEncoding`|Optional `String` output parameter.<br /><br /> Specifies the encoding of the captured task standard output stream. The default is the current console output encoding.|
Expand Down
2 changes: 1 addition & 1 deletion docs/msbuild/msbuild-diagnostic-format-for-tasks.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ ms.subservice: msbuild

# MSBuild and Visual Studio format for diagnostic messages

When a tool is executed that outputs some text, MSBuild examines the text for errors and warnings. Many tools use a known format to report these messages. By default, MSBuild examines the text and reports errors and/or warnings based on the output. This behavior can be changed or disabled by using these parameters on the `Exec` task: `IgnoreStandardErrorWarningFormat`, `CustomErrorRegularExpression`, and `CustomWarningRegularExpression`.
When a tool is executed that outputs some text, MSBuild examines the text for errors and warnings. Many tools use a known format to report these messages. By default, MSBuild examines the text and reports errors and/or warnings based on the output. This behavior can be augmented or disabled by using these parameters on the `Exec` task: `IgnoreStandardErrorWarningFormat`, `CustomErrorRegularExpression`, and `CustomWarningRegularExpression`.

> [!NOTE]
> If you do decide to use your own regular expression to detect error and warnings, then you should know that MSBuild will look at the result one line at a time. Even if your custom regex would match something across multiple lines, it will not behave that way because of how MSBuild processes that text.
Expand Down

0 comments on commit 4d0b466

Please sign in to comment.