<fail>

Exits the current build by throwing a NAnt.Core.BuildException, optionally printing additional information.

The cause of the build failure can be specified using the NAnt.Core.Tasks.FailTask.Message attribute or as inline content.

Macros in the message will be expanded.

Parameters

Attribute Type Description Required
message string
A message giving further information on why the build exited.
False
failonerror bool
Determines if task failure stops the build, or is just reported. The default is true.
False
if bool
If true then the task will be executed; otherwise, skipped. The default is true.
False
unless bool
Opposite of NAnt.Core.Task.IfDefined. If false then the task will be executed; otherwise, skipped. The default is false.
False
verbose bool
Determines whether the task should report detailed build log messages. The default is false.
False

Examples

Exits the current build without giving further information.

<fail />

Exits the current build and writes a message to the build log.

<fail message="Something wrong here." />

Functionally equivalent to the previous example.

<fail>Something wrong here.</fail>

Requirements

Assembly
NAnt.Core.dll
Namespace
NAnt.Core.Tasks