The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

Error Task

Stops a build and logs an error based on an evaluated conditional statement.

The folowing table describes the parameters of the Error task.

Parameter Description


Optional String parameter.

The error code to associate with the error.


Optional String parameter.

The Help keyword to associate with the error.


Optional String parameter.

The error text that MSBuild logs if the Condition parameter evaluates to true.

The Error task allows MSBuild projects issue error text to loggers and stop build execution.

If the Condition parameter evaluates to true, the build is stopped, and an error is logged. If a Condition parameter does not exist, the error is logged and build execution stops. For more information on logging, see MSBuild Logging.

The following code example verifies that all required properties are set. If they are not set, the project raises an error event, and logs the value of the Text parameter of the Error task.

<Project xmlns="">
    <Target Name="ValidateCommandLine">
            Text=" The 0 property must be set on the command line."
            Condition="'$(0)' == ''" />
            Text="The FREEBUILD property must be set on the command line."
            Condition="'$(FREEBUILD)' == ''" />
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

© 2015 Microsoft