NAnt SDK Documentation - v0.92 |

# BuildAttributeAttribute Class

Indicates that property should be treated as a XML attribute for the task.

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

System.Object
System.Attribute
NAnt.Core.Attributes.BuildAttributeAttribute
NAnt.Core.Attributes.TaskAttributeAttribute

[Visual Basic]
<AttributeUsage(Inherited:=True, ValidOn:=AttributeTargets.Property, AllowMultiple:=False)>
MustInherit Public Class BuildAttributeAttribute
Inherits Attribute
[C#]
[AttributeUsage(Inherited=True, ValidOn=AttributeTargets.Property, AllowMultiple=False)]
public abstract class BuildAttributeAttribute : Attribute

#### 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.

#### Example

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

#### Requirements

Namespace: NAnt.Core.Attributes

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

#### See Also

BuildAttributeAttribute Members | NAnt.Core.Attributes Namespace