Summary
- Assembly
- NAnt
.Core .dll - Namespace
- NAnt
.Core .Tasks - Interfaces
- Base Types
Syntax
[TaskName("nant")]
public class NAntTask : Task, IConditional
Examples
Build a project located in a different directory if the debug
property is not true
.
<nant buildfile="${src.dir}/Extras/BuildServer/BuildServer.build" unless="${debug}" />
Build a project while adding a set of properties to that project.
<nant buildfile="${src.dir}/Extras/BuildServer/BuildServer.build">
<properties>
<property name="build.dir" value="c:/buildserver" />
<property name="build.debug" value="false" />
<property name="lib.dir" value="c:/shared/lib" readonly="true" />
</properties>
</nant>
Build all projects named default.build
located anywhere under
the project base directory.
<nant>
<buildfiles>
<include name="**/default.build" />
<!-- avoid recursive execution of current build file -->
<exclude name="${project::get-buildfile-path()}" />
</buildfiles>
</nant>
Remarks
By default, all the properties of the current project will be available
in the new project. Alternatively, you can set NAnt.Core.Tasks.NAntTask.InheritAll
to false
to not copy any properties to the new
project.
You can also set properties in the new project from the old project by
using nested property tags. These properties are always passed to the
new project regardless of the setting of NAnt.Core.Tasks.NAntTask.InheritAll
.
This allows you to parameterize your subprojects.
References to data types can also be passed to the new project, but by
default they are not. If you set the NAnt.Core.Tasks.NAntTask.InheritRefs
to
true
, all references will be copied.
Attributes
Type | Description |
---|---|
TaskNameAttribute | Indicates that class should be treated as a task. |
Properties
Name | Value | Summary |
---|---|---|
BuildFile | FileInfo |
The build file to build.
|
BuildFiles | FileSet |
Used to specify a set of build files to process.
|
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
|
DefaultTarget | string |
The target to execute. To specify more than one target separate
targets with a space. Targets are executed in order if possible.
The default is to use target specified in the project's default
attribute.
|
FailOnError | bool |
Determines if task failure stops the build, or is just reported.
The default is
true .
Inherited from Task
|
IfDefined | bool |
If
true then the task will be executed; otherwise,
skipped. The default is true .
Inherited from Task
|
InheritAll | bool |
Specifies whether current property values should be inherited by
the executed project. The default is
true .
|
InheritRefs | bool |
Specifies whether all references will be copied to the new project.
The default is
false .
|
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
|
OverrideProperties | ArrayList |
Specifies a collection of properties that should be created in the
executed project. Note, existing properties with identical names
that are not read-only will be overwritten.
|
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
|
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 |
Validates the
NAnt.Core.Tasks.NAntTask element.
|
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
|