NAnt SDK Documentation - v0.92 |

# PropertyTask Class

Sets a property in the current project.

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

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

[Visual Basic]
<TaskName(Name:="property")>
Public Class PropertyTask
Inherits Task
[C#]
[TaskName(Name="property")]
public class PropertyTask : 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

> Note NAnt uses a number of predefined properties.

#### Example

Define a `debug` property with value true.

    <property name="debug" value="true" />

Use the user-defined `debug` property.

    <property name="trace" value="${debug}" />

Define a read-only property. This is just like passing in the param on the command line.

    <property name="do_not_touch_ME" value="hammer" readonly="true" />

Define a property, but do not overwrite the value if the property already exists (eg. it was specified on the command line).

    <project name="property-example">
      <property name="debug" value="true" overwrite="false" />
      <echo message="debug: ${debug}" />
    </project>

Executing this build file with the command line option `-D:debug=false`, would cause the value specified on the command line to remain unaltered.

    [echo] debug: false

#### Requirements

Namespace: NAnt.Core.Tasks

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

#### See Also

PropertyTask Members | NAnt.Core.Tasks Namespace