BuildAttributeAttribute Class

Summary

Indicates that property should be treated as a XML attribute for the task.
Assembly
NAnt.Core.dll
Namespace
NAnt.Core.Attributes
Base Types
Derived Types
graph BT Type-->Base0["BaseBuildAttribute"] click Base0 "/api/NAnt.Core.Attributes/BaseBuildAttribute" Base0-->Base1["Attribute"] Type["BuildAttributeAttribute"] class Type type-node Derived0["TaskAttributeAttribute"]-->Type click Derived0 "/api/NAnt.Core.Attributes/TaskAttributeAttribute"

Syntax

[AttributeUsage(AttributeTargets.Property, Inherited = true)]
public abstract class BuildAttributeAttribute : BaseBuildAttribute

Examples

Examples of how to specify task attributes
 #region Public Instance Properties
 
 [BuildAttribute("out", Required=true)]
 public string Output {
     get { return _out; }
     set { _out = value; }
 }

 [BuildAttribute("optimize")]
 [BooleanValidator()]
 public bool Optimize {
     get { return _optimize; }
     set { _optimize = value; }
 }

 [BuildAttribute("warnlevel")]
 [Int32Validator(0,4)] // limit values to 0-4
 public int WarnLevel {
     get { return _warnLevel; }
     set { _warnLevel = value; }
 }

 [BuildElement("sources")]
 public FileSet Sources {
     get { return _sources; }
     set { _sources = value; }
 }
 
 #endregion Public Instance Properties
 
 #region Private Instance Fields
 
 private string _out = null;
 private bool _optimize = false;
 private int _warnLevel = 4;
 private FileSet _sources = new FileSet();
 
 #endregion Private Instance Fields

Attributes

Type Description
AttributeUsageAttribute

Constructors

Name Summary
BuildAttributeAttribute(string) Initializes a new instance of the NAnt.Core.Attributes.BuildAttributeAttribute with the specified name.

Properties

Name Value Summary
ExpandProperties bool
Gets or sets a value indicating whether property references should be expanded.
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