Summary
Indicates that property should be treated as a XML attribute for the
task.
- Assembly
- NAnt
.Core .dll - Namespace
- NAnt
.Core .Attributes - Base Types
-
- Attribute
- BaseBuildAttribute
- Build
Attribute Attribute
graph BT
Type-->Base0["BuildAttributeAttribute"]
click Base0 "/api/NAnt.Core.Attributes/BuildAttributeAttribute"
Base0-->Base1["BaseBuildAttribute"]
click Base1 "/api/NAnt.Core.Attributes/BaseBuildAttribute"
Base1-->Base2["Attribute"]
Type["TaskAttributeAttribute"]
class Type type-node
Syntax
[AttributeUsage(AttributeTargets.Property, Inherited = true)]
public sealed class TaskAttributeAttribute : BuildAttributeAttribute
Examples
Examples of how to specify task attributes
// task XmlType default is string
[TaskAttribute("out", Required=true)]
string _out = null; // assign default value here
[TaskAttribute("optimize")]
[BooleanValidator()]
// during ExecuteTask you can safely use Convert.ToBoolean(_optimize)
string _optimize = Boolean.FalseString;
[TaskAttribute("warnlevel")]
[Int32Validator(0,4)] // limit values to 0-4
// during ExecuteTask you can safely use Convert.ToInt32(_optimize)
string _warnlevel = "0";
[BuildElement("sources")]
FileSet _sources = new FileSet();
NOTE: Attribute values must be of type of string if you want
to be able to have macros. The field stores the exact value during
Initialize. Just before ExecuteTask is called NAnt will expand
all the macros with the current values.
Attributes
Type | Description |
---|---|
Attribute |
Constructors
Name | Summary |
---|---|
Task |
Initializes a new instance of the NAnt.Core.Attributes.TaskAttributeAttribute
with the specified attribute name.
|
Properties
Name | Value | Summary |
---|---|---|
ExpandProperties | bool |
Gets or sets a value indicating whether property references should
be expanded.
Inherited from Build
|
Name | string |
Gets or sets the name of the item.
Inherited from BaseBuildAttribute
|
ProcessXml | bool |
Used to specify how this element will be handled as the XML is parsed
and given to the element.
Inherited from BaseBuildAttribute
|
Required | bool |
Gets or sets a value indicating whether the item is required.
Inherited from BaseBuildAttribute
|