Project Class

Summary

Central representation of a NAnt project.
Assembly
NAnt.Core.dll
Namespace
NAnt.Core
Base Types
  • Object
graph BT Type-->Base0["Object"] Type["Project"] class Type type-node

Syntax

[Serializable()]
public class Project

Examples

The NAnt.Core.Project.Run method will initialize the project with the build file specified in the constructor and execute the default target.

    Project p = new Project("foo.build", Level.Info);
p.Run();

If no target is given, the default target will be executed if specified in the project.

    Project p = new Project("foo.build", Level.Info);
p.Execute("build");

Attributes

Type Description
SerializableAttribute

Constructors

Name Summary
Project(string, Level, int) Initializes a new NAnt.Core.Project class with the given source, message threshold and indentation level.
Project(string, Level, int, XmlNode) Initializes a new NAnt.Core.Project class with the given source, message threshold and indentation level, and using the specified System.Xml.XmlNode to load internal configuration settings.
Project(XmlDocument, Level, int) Initializes a new NAnt.Core.Project class with the given document, message threshold and indentation level.
Project(XmlDocument, Level, int, XmlNode) Initializes a new NAnt.Core.Project class with the given document, message threshold and indentation level, and using the specified System.Xml.XmlNode to load internal configuration settings.

Events

Name Type Summary
BuildFinished BuildEventHandler
Occurs when a build has finished.
BuildStarted BuildEventHandler
Occurs when a build is started.
MessageLogged BuildEventHandler
Occurs when a message is logged.
TargetFinished BuildEventHandler
Occurs when a target has finished.
TargetStarted BuildEventHandler
Occurs when a target is started.
TaskFinished BuildEventHandler
Occurs when a task has finished.
TaskStarted BuildEventHandler
Occurs when a task is started.

Properties

Name Value Summary
BaseDirectory string
Gets or sets the base directory used for relative references.
BuildFileLocalName string
Gets the path to the build file.
BuildFileUri Uri
Gets the System.Uri form of the current project definition.
BuildListeners BuildListenerCollection
Gets the build listeners for this project.
BuildTargets StringCollection
The list of targets to build.
ConfigurationNode XmlNode
Gets the System.Xml.XmlNode NAnt should use to initialize configuration settings.
CurrentTarget Target
Gets the current target.
DataTypeReferences DataTypeBaseDictionary
Gets the NAnt.Core.DataTypeBase instances defined in this project.
DefaultTargetName string
Document XmlDocument
Gets the active NAnt.Core.Project definition.
FrameworkNeutralProperties PropertyDictionary
Gets the framework-neutral properties defined in the NAnt configuration file.
Frameworks FrameworkInfoDictionary
Gets a collection of available .NET frameworks.
IndentationLevel int
Gets or sets the indendation level of the build output.
IndentationSize int
Gets or sets the indentation size of the build output.
NamespaceManager XmlNamespaceManager
Gets the System.Xml.XmlNamespaceManager.
PlatformName string
Gets the name of the platform on which NAnt is currently running.
ProjectName string
Gets the name of the NAnt.Core.Project.
Properties PropertyDictionary
Gets the properties defined in this project.
RunTargetsInParallel bool
Gets or sets a value indicating whether independent targets should be executed in parallel execution threads.
RuntimeFramework FrameworkInfo
Gets the framework in which NAnt is currently running.
TargetFramework FrameworkInfo
Gets or sets the framework to use for compilation.
Targets TargetCollection
Gets the targets defined in this project.
Threshold Level
Gets or sets the default threshold level for build loggers.
Verbose bool
Gets a value indicating whether tasks should output more build log messages.

Methods

Name Value Summary
AttachBuildListeners(BuildListenerCollection) void
Attaches the specified build listeners to the NAnt.Core.Project.
CreateDataTypeBase(XmlNode) DataTypeBase
Creates the NAnt.Core.DataTypeBase instance from the passed XML node.
CreateDefaultLogger() void
Creates the default NAnt.Core.IBuildLogger and attaches it to the NAnt.Core.Project.
CreateTask(XmlNode) Task
Creates a new from the given System.Xml.XmlNode.
CreateTask(XmlNode, Target) Task
Creates a new NAnt.Core.Task from the given System.Xml.XmlNode within a NAnt.Core.Target.
DetachBuildListeners() void
Detaches the currently attached NAnt.Core.IBuildListener instances from the NAnt.Core.Project.
Execute() void
Executes the default target.
Execute(string) void
Executes a specific target, and its dependencies.
Execute(string, bool) void
Executes a specific target.
ExpandProperties(string, Location) string
Expands a string from known properties.
GetFullPath(string) string
Combines the specified path with the NAnt.Core.Project.BaseDirectory of the NAnt.Core.Project to form a full path to file or directory.
GetLocation(XmlNode) Location
Returns the NAnt.Core.Location of the given node in an XML file loaded by NAnt.
Indent() void
Increases the NAnt.Core.Project.IndentationLevel of the NAnt.Core.Project.
Log(Level, string) void
Writes a NAnt.Core.Project level message to the build log with the given NAnt.Core.Level.
Log(Level, string, Object[]) void
Writes a NAnt.Core.Project level formatted message to the build log with the given NAnt.Core.Level.
Log(Target, Level, string) void
Writes a NAnt.Core.Target level message to the build log with the given NAnt.Core.Level.
Log(Task, Level, string) void
Writes a NAnt.Core.Task task level message to the build log with the given NAnt.Core.Level.
OnBuildFinished(Object, BuildEventArgs) void
Dispatches a NAnt.Core.Project.BuildFinished event to the build listeners for this NAnt.Core.Project.
OnBuildStarted(Object, BuildEventArgs) void
Dispatches a NAnt.Core.Project.BuildStarted event to the build listeners for this NAnt.Core.Project.
OnMessageLogged(BuildEventArgs) void
Dispatches a NAnt.Core.Project.MessageLogged event to the build listeners for this NAnt.Core.Project.
OnTargetFinished(Object, BuildEventArgs) void
Dispatches a NAnt.Core.Project.TargetFinished event to the build listeners for this NAnt.Core.Project.
OnTargetStarted(Object, BuildEventArgs) void
Dispatches a NAnt.Core.Project.TargetStarted event to the build listeners for this NAnt.Core.Project.
OnTaskFinished(Object, BuildEventArgs) void
Dispatches the NAnt.Core.Project.TaskFinished event to the build listeners for this NAnt.Core.Project.
OnTaskStarted(Object, BuildEventArgs) void
Dispatches a NAnt.Core.Project.TaskStarted event to the build listeners for this NAnt.Core.Project.
Run() bool
Executes the default target and wraps in error handling and time stamping.
TopologicalTargetSort(string, TargetCollection) TargetCollection
Topologically sorts a set of targets.
Unindent() void
Decreases the NAnt.Core.Project.IndentationLevel of the NAnt.Core.Project.