NAnt SDK Documentation - v0.92 |

# EchoTask Class

Writes a message to the build log or a specified file.

For a list of all members of this type, see EchoTask Members.

System.Object
NAnt.Core.Element
NAnt.Core.Task
NAnt.Core.Tasks.EchoTask

[Visual Basic]
<TaskName(Name:="echo")>
Public Class EchoTask
Inherits Task
[C#]
[TaskName(Name="echo")]
public class EchoTask : Task

#### Thread Safety

Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.

#### Remarks

The message can be specified using the Message attribute or as inline content. If neither is included - or the message contains only whitespace - then an empty message will be emitted in the output.

Macros in the message will be expanded.

When writing to a file, the MessageLevel attribute is ignored.

> Note Since NAnt 0.86, a newline will no longer be implictly added when writing a message to a file.

#### Example

Writes a message with level Debug to the build log.

    <echo message="Hello, World!" level="Debug" />

Writes a two-line message to the build log using inline content.

    <echo>First line
    Second line</echo>

Writes a two-line message to the build log using the Message attribute.

    <echo message='First line
    Second line</echo>

Writes a message with expanded macro to the build log.

    <echo message="Base build directory = ${nant.project.basedir}" />

Functionally equivalent to the previous example.

    <echo>Base build directory = ${nant.project.basedir}</echo>

Writes the previous message to a file in the project directory, overwriting the file if it exists.

    <echo file="buildmessage.txt">Base build directory = ${nant.project.basedir}</echo>

#### Requirements

Namespace: NAnt.Core.Tasks

Assembly: NAnt.Core (in NAnt.Core.dll)

#### See Also

EchoTask Members | NAnt.Core.Tasks Namespace