Summary
Changes the file attributes of a file or set of files and directories.
- Assembly
- NAnt
.Core .dll - Namespace
- NAnt
.Core .Tasks - Interfaces
- Base Types
graph BT
Type-->Base0["Task"]
click Base0 "/api/NAnt.Core/Task"
Base0-->Base1["Element"]
click Base1 "/api/NAnt.Core/Element"
Base1-->Base2["Object"]
Type-.->Interface0["IConditional"]
click Interface0 "/api/NAnt.Core/IConditional"
Type["AttribTask"]
class Type type-node
Syntax
[TaskName("attrib")]
public class AttribTask : Task, IConditional
Examples
Set the read-only
file attribute for the specified file in
the project directory.
<attrib file="myfile.txt" readonly="true" />
Set the normal
file attribute for the specified file.
<attrib file="myfile.txt" normal="true" />
Set the normal
file attribute for all executable files in
the current project directory and sub-directories.
<attrib normal="true">
<fileset>
<include name="**/*.exe" />
<include name="bin" />
</fileset>
</attrib>
Remarks
NAnt.Core.Tasks.AttribTask
does not have the concept of turning
attributes off. Instead you specify all the attributes that you want
turned on and the rest are turned off by default.
Refer to the System.IO.FileAttributes
enumeration in the .NET SDK
for more information about file attributes.
Attributes
Type | Description |
---|---|
TaskNameAttribute | Indicates that class should be treated as a task. |
Properties
Name | Value | Summary |
---|---|---|
ArchiveAttrib | bool |
Set the archive attribute. The default is
false .
|
AttribFileSet | FileSet |
All the matching files and directories in this fileset will have
their attributes set.
|
CustomXmlProcessing | bool |
Gets a value indicating whether the element is performing additional
processing using the
NAnt.Core.Element.XmlNode that was used to
initialize the element.
Inherited from Element
|
FailOnError | bool |
Determines if task failure stops the build, or is just reported.
The default is
true .
Inherited from Task
|
File | FileInfo |
The name of the file which will have its attributes set. This is
provided as an alternate to using the task's fileset.
|
HiddenAttrib | bool |
Set the hidden attribute. The default is
false .
|
IfDefined | bool |
If
true then the task will be executed; otherwise,
skipped. The default is true .
Inherited from Task
|
Location | Location |
Gets or sets the location in the build file where the element is
defined.
Inherited from Element
|
LogPrefix | string |
The prefix used when sending messages to the log.
Inherited from Task
|
Name | string |
The name of the task.
Inherited from Task
|
NamespaceManager | XmlNamespaceManager |
Gets or sets the
System.Xml.XmlNamespaceManager .
Inherited from Element
|
NormalAttrib | bool |
Set the normal file attributes. This attribute is only valid if used
alone. The default is
false .
|
Parent | Object |
Gets or sets the parent of the element.
Inherited from Element
|
Project | Project |
Gets or sets the
NAnt.Core.Element.Project to which this element belongs.
Inherited from Element
|
Properties | PropertyDictionary |
Gets the properties local to this
NAnt.Core.Element and the
NAnt.Core.Element.Project .
Inherited from Element
|
ReadOnlyAttrib | bool |
Set the read-only attribute. The default is
false .
|
SystemAttrib | bool |
Set the system attribute. The default is
false .
|
Threshold | Level |
Gets or sets the log threshold for this
NAnt.Core.Task . By
default the threshold of a task is NAnt.Core.Level.Debug ,
causing no messages to be filtered in the task itself.
Inherited from Task
|
UnlessDefined | bool |
Opposite of
NAnt.Core.Task.IfDefined . If false
then the task will be executed; otherwise, skipped. The default is
false .
Inherited from Task
|
Verbose | bool |
Determines whether the task should report detailed build log messages.
The default is
false .
Inherited from Task
|
XmlNode | XmlNode |
Gets or sets the XML node of the element.
Inherited from Element
|
Methods
Name | Value | Summary |
---|---|---|
CopyTo |
void |
Copies all instance data of the
NAnt.Core.Element to a given
NAnt.Core.Element .
Inherited from Element
|
Execute |
void |
Executes the task unless it is skipped.
Inherited from Task
|
ExecuteTask |
void |
Executes the task.
|
Get |
XmlNode |
Locates the XML node for the specified attribute in either the
configuration section of the extension assembly or the.project.
Inherited from Task
|
Get |
XmlNode |
Inherited from Element
|
GetLocation |
Location |
Retrieves the location in the build file where the element is
defined.
Inherited from Element
|
Initialize |
void |
Initializes the task.
Inherited from Task
|
Initialize |
void |
Performs default initialization.
Inherited from Element
|
Initialize |
Element |
Initializes the build element.
Inherited from Element
static
|
InitializeElement |
void |
Derived classes should override to this method to provide extra
initialization and validation not covered by the base class.
Inherited from Element
|
InitializeTask |
void |
Initializes the task.
Inherited from Task
|
Initialize |
void |
Initializes the configuration of the task using configuration
settings retrieved from the NAnt configuration file.
Inherited from Task
|
InitializeXml |
void |
Initializes all build attributes and child elements.
Inherited from Element
|
IsLogEnabledFor |
bool |
Determines whether build output is enabled for the given
NAnt.Core.Level .
Inherited from Task
|
Log |
void |
Logs a message with the given priority.
Inherited from Task
|
Log |
void |
Logs a formatted message with the given priority.
Inherited from Task
|