<property>

Sets a property in the current project.
NAnt uses a number of predefined properties.

Parameters

Attribute Type Description Required
name string
The name of the NAnt property to set.
True
value string
The value to assign to the NAnt property.
True
dynamic bool
Specifies whether references to other properties should not be expanded when the value of the property is set, but expanded when the property is actually used. By default, properties will be expanded when set.
False
overwrite bool
Specifies whether the value of a property should be overwritten if the property already exists (unless the property is read-only). The default is true.
False
readonly bool
Specifies whether the property is read-only or not. The default is false.
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

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

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