Language
Edit

Message task

Logs a message during a build.

Parameters

The following table describes the parameters of the Message task.

Parameter Description
Code Optional String parameter.

Specifies the message code. The task includes it in the logged message when File is specified or IsCritical is true.
File Optional String parameter.

Specifies the file associated with the message. For a critical message, the default is the file containing the task.
HelpKeyword Optional String parameter.

Specifies the help keyword. The task includes it in the logged message when File is specified or IsCritical is true.
Importance Optional String parameter.

Specifies the importance of the message. This parameter can have a value of high, normal or low. The default value is normal.
IsCritical Optional Boolean parameter.

If true, logs the message as a critical message. The default is false.
Text Optional String parameter.

The message text to log.

Remarks

The Message task allows MSBuild projects to issue messages to loggers at different steps in the build process.

If the Condition parameter evaluates to true, the value of the Text parameter will be logged and the build will continue to execute. If a Condition parameter does not exist, the message text is logged. For more information on logging, see Obtain build logs.

By default, the message is sent to all registered loggers. The logger interprets the Importance parameter. Typically, a message set to high is sent when logger verbosity is set to LoggerVerbosity.Minimal or higher. A message set to low is sent when logger verbosity is set to LoggerVerbosity.Detailed.

In addition to the parameters listed above, this task inherits parameters from the TaskExtension class, which itself inherits from the Task class. For a list of these additional parameters and their descriptions, see TaskExtension base class.

Example

The following code example logs messages to all registered loggers.

<Project>
    <Target Name="DisplayMessages">
        <Message Text="Project File Name = $(MSBuildProjectFile)" />
        <Message Text="Project Extension = $(MSBuildProjectExtension)" />
    </Target>
    ...
</Project>

See also