NAnt.Core
Indicates that field should be able to be converted into a Boolean.
Indicates that field should be treated as a xml attribute for the task.
Examples of how to specify task attributes
// task XmlType default is string
[BuildAttribute("out", Required=true)]
string _out = null; // assign default value here
[BuildAttribute("optimize")]
[BooleanValidator()]
// during ExecuteTask you can safely use Convert.ToBoolean(_optimize)
string _optimize = Boolean.FalseString;
[BuildAttribute("warnlevel")]
[Int32Validator(0,4)] // limit values to 0-4
// during ExecuteTask you can safely use Convert.ToInt32(_optimize)
string _warnlevel = "0";
[FileSet("sources")]
FileSet _sources = new FileSet();
NOTE: Attribute values must be of type of string if you want
to be able to have macros. The field stores the exact value during
InitializeTask. Just before ExecuteTask is called NAnt will expand
all the macros with the current values.
Indicates that property should be treated as a xml arrayList for the task.
Indicates that field should be treated as a xml file set for the task.
Indicates that class should be treated as a NAnt element.
Attach this attribute to a subclass of Element to have NAnt be able
to recognize it. The name should be short but must not confict
with any other element already in use.
Indicates that field should be able to be converted into a Int32 within the given range.
Indicates that field should be treated as a xml attribute for the task.
Examples of how to specify task attributes
// task XmlType default is string
[TaskAttribute("out", Required=true)]
string _out = null; // assign default value here
[TaskAttribute("optimize")]
[BooleanValidator()]
// during ExecuteTask you can safely use Convert.ToBoolean(_optimize)
string _optimize = Boolean.FalseString;
[TaskAttribute("warnlevel")]
[Int32Validator(0,4)] // limit values to 0-4
// during ExecuteTask you can safely use Convert.ToInt32(_optimize)
string _warnlevel = "0";
[FileSet("sources")]
FileSet _sources = new FileSet();
NOTE: Attribute values must be of type of string if you want
to be able to have macros. The field stores the exact value during
InitializeTask. Just before ExecuteTask is called NAnt will expand
all the macros with the current values.
Indicates that field should be treated as a xml file set for the task.
Indicates that class should be treated as a task.
Attach this attribute to a subclass of Task to have NAnt be able
to recognize it. The name should be short but must not confict
with any other task already in use.
Class to represent a test element of an NUnit task
Models a NAnt XML element in the build file.
Automatically validates attributes in the element based on Attribute settings in the derived class.
The default contstructor.
A copy contstructor.
Initializes all build attributes.
Performs default initialization.
Derived classes that wish to add custom initialization should override .
Allows derived classes to provide extra initialization and validation not covered by the base class.
The xml node of the element to use for initialization.
in the build file where the element is defined.
Name of the XML element used to initialize this element.
this element belongs to.
Class Name of the test
Assembly to Load the test from
Run the tests in a separate AppDomain
Stop the build process if an error occurs during the test run
Stop the build process if a test fails (errors are considered failures as well).
The built-in formatter types.
class to represent the FormatterElement of the NUnit task.
Type of formatter ( means we will load a class of the form (type)Formatter
Name of a custom formatter class.
Extension to append to the output filename..
Boolean that determines whether output should be sent to a file.
Summary description for IResultFormatter.
The whole test suite started.
The whole test suite ended.
Sets the Writer the formatter is supposed to write its results to.
Prints information about running tests directly to the Log class.
Not used, all output goes to Log class.
Called when the whole test suite has started.
Called when the whole test suite has ended.
Convert a stack trace line into something that can be clicked on in an IDE output window.
The StackTrace string, see .
The string that gets appended to the end of file(line): portion.
Runs tests using the NUnit framework.
See the NUnit home page for more information.
Run tests in the MyProject.Tests.dll assembly.
The test results are logged in results.xml and results.txt using the Xml and Plain formatters, respectively.
]]>
Provides the abstract base class for tasks.
A task is a piece of code that can be executed.
Executes the task unless it is skipped.
Deprecated (to be deleted).
Initializes the task.
Executes the task.
Determines if task failure stops the build, or is just reported. Default is "true".
Task reports detailed build log messages. Default is "false".
If true then the task will be executed; otherwise skipped. Default is "true".
Opposite of if. If false then the task will be executed; otherwise skipped. Default is "false".
The name of the task.
The prefix used when sending messages to the log.
The target the task belongs to.
Xml node used to initialize this task instance.
Return the file or null if does not use a file.
Run the tests in a separate AppDomain.
Stop the build process if an error occurs during the test run.
Implies haltonfailure.
Stop the build process if a test fails (errors are considered failures as well).
Cancel the individual tests if they do not finish in the specified time (measured in milliseconds). Ignored if fork is disabled.
Base name of the test result. The full filename is determined by this attribute and the extension of formatter
Directory to write the reports to.
Returns the test suite from a given class.
The assemblyQualifiedName parameter needs to be in form:
"full.qualified.class.name,Assembly"
Runs a Suite extracted from a TestCase subclass.
Collection of the registered formatters.
Prints information about running tests in simple plain text.
Sets the Writer the formatter is supposed to write its results to.
Called when the whole test suite has started.
Called when the whole test suite has ended.
Convert a stack trace line into something that can be clicked on in an IDE output window.
The StackTrace string, see .
The string that gets appended to the end of file(line): portion.
This is purely to decorate NUnits TestResult with extra information such as run-time etc ...
TODO come up with a better name
Prints detailed information in XML format about running tests.
Sets the Writer the formatter is supposed to write its results to.
Called when the whole test suite has started.
Called when the whole test suite has ended.
Wraps al, the assembly linker for the .NET Framework.
All specified sources will be embedded using the /embed flag. Other source types are not supported.
Create a library containing all icon files in the current directory.
]]>
Provides the abstract base class for tasks that execute external applications.
Get the command line arguments, separated by spaces.
Sets the StartInfo Options and returns a new Process that can be run.
new Process with information about programs to run, etc.
Gets the application to start.
Gets the command line arguments for the application.
Gets the working directory for the application.
The maximum amount of time the application is allowed to execute, expressed in milliseconds. Defaults to no time-out.
Get the command line arguments for the application.
The name of the output file for the assembly manifest.
This attribute corresponds to the /out flag.
The target type (one of "lib", "exe", or "winexe").
This attribute corresponds to the /t[arget]: flag.
The culture string associated with the output assembly.
The string must be in RFC 1766 format, such as "en-US".
This attribute corresponds to the /c[ulture]: flag.
Specifies an assembly from which to get all options except the culture field.
The given filename must have a strong name.
This attribute corresponds to the /template: flag.
The set of source files to embed.
Changes the file attributes of a file or set of files.
The attrib task does not have the concept of turning file attributes off. Instead you specify all the attributes that you want turned on and the rest are turned off by default.
Refer to the FileAttributes enumeration in the .NET SDK for more information about file attributes.
Set the ReadOnly attribute to true for the specified file in the project directory.
]]>
Set the normal file attributes to the specified file.
]]>
Set the normal file attributes to all executable files in the current project directory and sub-directories.
]]>
The name of the file which will have its attributes set. This is provided as an alternate to using the task's fileset.
All the files in this fileset will have their file attributes set.
Set the archive attribute. Default is "false".
Set the hidden attribute. Default is "false".
Set the normal file attributes. This attribute is valid only if used alone. Default is "false".
Set the read only attribute. Default is "false".
Set the system attribute. Default is "false".
Calls a NAnt target in the current project.
Call the target "build".
]]>
NAnt target to call.
Force a Execute even if the target has already been executed
Compiles C/C++ programs using cl, Microsoft's C/C++ compiler.
This task is intended for version 13.00.9466 of cl.exe.
Compile helloworld.cpp for the Common Language Runtime.
]]>
Options to pass to the compiler.
Directory where all output files are placed.
The name of the precompiled header file.
The list of files to compile.
The list of directories in which to search for include files.
Provides the abstract base class for a Microsoft compiler task.
Allows derived classes to provide compiler-specific options.
Write an option using the default output format.
Write an option and its value using the default output format.
Gets the complete output path.
Determines whether compilation is needed.
Output directory for the compilation target.
Output type (library or exe).
Generate debug output (true/false).
Define conditional compilation symbol(s). Corresponds to /d[efine]: flag.
Icon to associate with the application. Corresponds to /win32icon: flag.
Reference metadata from the specified assembly files.
Set resources to embed.
Link the specified modules into this assembly.
The set of source files for compilation.
Copies a file or fileset to a new file or directory.
Files are only copied if the source file is newer than the destination file, or if the destination file does not exist. However, you can explicitly overwrite files with the overwrite attribute.
Filesets are used to select files to copy. To use a fileset, the todir attribute must be set.
Copy a single file.
<copy file="myfile.txt" tofile="mycopy.txt"/>
Copy a set of files to a new directory.
]]>
Actually does the file (and possibly empty directory) copies.
The file to copy.
The file to copy to.
The directory to copy to.
Overwrite existing files even if the destination files are newer. Defaults to "false".
Filesets are used to select files to copy. To use a fileset, the todir attribute must be set.
Compiles C# programs using csc, Microsoft's C# compiler.
Compile helloworld.cs to helloworld.exe.
]]>
The name of the XML documentation file to generate.
This attribute corresponds to the /doc: flag.
Deletes a file, fileset or directory.
Deletes either a single file, all files in a specified directory and its sub-directories, or a set of files specified by one or more filesets.
If the file attribute is set then the fileset contents will be ignored. To delete the files in the file set ommit the file attribute in the delete element.
Read-only files cannot be deleted. Use the first to remove the read-only attribute.
Delete a single file.
<delete file="myfile.txt"/>
Delete a directory and the contents within. If the directory does not exist the task does nothing.
<delete dir="${build.dir}" failonerror="false"/>
Delete a set of files. Note the lack of file attribute in the delete element.
]]>
The file to delete.
The directory to delete.
All the files in the file set will be deleted.
An empty task that allows a build file to contain a description.
Set a description.
This is a description.]]>
Writes a message to the build log.
Macros in the message will be expanded.
Writes message to build log.
<echo message="Hello, World!"/>
Writes message with expanded macro to build log.
<echo message="Base build directory = ${nant.project.basedir}"/>
The message to display.
Executes a system command.
Ping nant.sourceforge.net.
]]>
The program to execute without command arguments.
The command line arguments for the program.
The directory in which the command will be executed.
Stop the build if the command does not finish within the specified time. Specified in milliseconds. Default is no time out.
Exit the current build.
Exits the current build by throwing a BuildException, optionally printing additional information.
Will exit the current build with no further information given.
<fail/>
Will exit the current build and write message to build log.
<fail message="Something wrong here."/>
A message giving further information on why the build exited.
Get a particular file from a URL source.
Options include verbose reporting, timestamp based fetches and controlling actions on failures.
Currently, only HTTP and UNC protocols are supported. FTP support may be added when more pluggable protocols are added to the System.Net assembly.
The useTimeStamp option enables you to control downloads so that the remote file is only fetched if newer than the local copy. If there is no local copy, the download always takes place. When a file is downloaded, the timestamp of the downloaded file is set to the remote timestamp.
This timestamp facility only works on downloads using the HTTP protocol.
Gets the index page of the NAnt home page, and stores it in the file help/index.html.
<get src="http://nant.sourceforge.org/" dest="help/index.html"/>
Initializes task and ensures the supplied attributes are valid.
Xml node used to define this task instance.
This is where the work is done
Set the timestamp of a named file to a specified time.
The URL from which to retrieve a file.
The file where to store the retrieved file.
If inside a firewall, proxy server/port information
Format: {proxy server name}:{port number}
Example: proxy.mycompany.com:8080
Log errors but don't treat as fatal. ("true"/"false"). Default is "false".
Conditionally download a file based on the timestamp of the local copy. HTTP only. ("true"/"false"). Default is "false".
FileSets are used to select files to get.
Include an external build file.
This task is used to break your build file into smaller chunks. You can load a partial build file and have it included into the build file.
Any global (project level) tasks in the included build file are executed when this task is executed. Tasks in target elements are only executed if that target is executed.
The project element attributes are ignored.
This task can only be in the global (project level) section of the build file.
Include the script task that fetches the project version from the file "GetProjectVersion.include".
]]>
Used to check for recursived includes.
Verify parameters.
Xml taskNode used to define this task instance.
Build file to include.
Compiles Microsoft JScript.NET programs using jsc.
Compile helloworld.js to helloworld.exe.
]]>
Run lib.exe, Microsoft's Library Manager.
Create a library.
]]>
Options to pass to the compiler.
The output file name.
The list of files to combine into the output file.
The list of additional library directories to search.
Links files using link, Microsoft's Incremental Linker.
This task is intended for version 7.00.9466 of link.exe.
Combine all object files in the current directory into helloworld.exe.
]]>
Options to pass to the compiler.
The output file name.
The list of files to combine into the output file.
The list of additional library directories to search.
A task to send SMTP email.
Text and text files to include in the message body may be specified as well as binary attachments.
Sends an email from nant@sourceforge.net to three recipients with a subject about the attachments. The body of the message will be the combined contents of body1.txt through body4.txt. The body1.txt through body3.txt files will also be included as attachments. The message will be sent using the smtpserver.anywhere.com SMTP server.
]]>
Initializes task and ensures the supplied attributes are valid.
Xml node used to define this task instance.
This is where the work is done
Reads a text file and returns the contents
in a string
Email address of sender
Comma- or semicolon-separated list of recipient email addresses
Comma- or semicolon-separated list of CC: recipient email addresses
Comma- or semicolon-separated list of BCC: recipient email addresses
Host name of mail server. Defaults to "localhost"
Text to send in body of email message.
Text to send in subject line of email message.
Format of the message body. Valid values are "Html" or "Text". Defaults to "Text".
Name(s) of text files to send as part of body of the email message.
Multiple file names are comma- or semicolon-separated.
Name(s) of files to send as attachments to email message.
Multiple file names are comma- or semicolon-separated.
Compiles C# programs using the mono mcs compiler.
See the mono home page for more information.
Compile helloworld.cs to helloworld.exe.
]]>
Creates a directory and any non-existent parent directories if necessary.
Create the directory "build".
]]>
Create the directory tree "one/two/three".
]]>
The directory to create.
Moves a file or fileset to a new file or directory.
Moves a file or fileset to a new file or directory. Files are only moved if the source file is newer than the destination file, or if the destination file does not exist.
You can explicitly overwrite files with the overwrite attribute.
Filesets are used to select files to move. To use a fileset, the todir attribute must be set.
Move a single file.
<move file="myfile.txt" tofile="mytarget.txt"/>
Move a set of files.
]]>
Actually does the file (and possibly empty directory) moves.
Creates an XSD File for all available Tasks.
This can be used in conjuntion with the command line option to do XSD Schema validation on the build file.
Creates an NAnt.xsd file in the current project directory
]]>
Creates a NAnt Schema for given types
The output stream to save the schema to. If null, writing is ignored, no exception generated
The list of Types to generate Schema for
The target Namespace to output
The new NAnt Schema
Creates a new XmlSchemaAttribute
XmlSchemaAttribute.Name
sets XmlSchemaAttribute.Use
The attribute
ComplexType.Name
ComplexType.id
ComplexType.Attributes; null indicates none.
Generates a new object.
The min value to allow for this choice
The max value to allow, Decimal.MaxValue sets it to 'unbound'
Searches throught custom attributes for any attribute based on attr
MemberInfo (includes Properties/Fields/Types)
Type of the Attribute you want; meaning that you want something derived by it.
Search the MemberInfo class ancestry
Search the Attribute Type ancestry for a mactch to attr
Creates a new SchemaGenerator.
The namespace to use.
http://tempuri.org/nant.xsd
Creates a new SchemaGenerator without a TargetNamespace.
The Collection of Type(s) that represent the Task Classes to generation XSD for.
Runs NAnt on a supplied build file. This can be used to build subprojects.
Build the BuildServer project located in a different directory but only if the debug property is not true.
]]>
The build file to build.
The target to execute. To specify more than one target seperate targets with a space. Targets are executed in order if possible. Default to use target specified in the project's default attribute.
Specifies whether current property values should be inherited by the executed project. Default is false.
Runs NDoc to create documentation.
See the NDoc home page for more information.
Document two assemblies using the MSDN documenter. The namespaces are documented in NamespaceSummary.xml
]]>
NamespaceSummary.xml contents
The Foo.Bar namespace reinvents the wheel.
The Foo.Bar.Tests namespace ensures that the Foo.Bar namespace reinvents the wheel correctly.
]]>
Updates the progress bar representing a building step.
Initialize taks and verify parameters.
Node that contains the XML fragment used to define this task instance.
Returns the documenter instance to use for this task.
Perform macro expansion for the given XmlNodeList.
The set of assemblies to document.
The set of namespace summary files.
Sets a property in the current project.
NAnt uses a number of predefined properties.
Define a debug property with the value true.
]]>
Use the user-defined debug property.
]]>
the name of the property to set.
the value of the property.
Executes the code contained within the task.
The script element must contain a single code element, which in turn contains the script code.
A static entry point named ScriptMain is required. It must have a single parameter.
The following namespaces are loaded by default:
System,
System.Collections,
System.Collections.Specialized,
System.IO,
System.Text,
System.Text.RegularExpressions and
SourceForge.NAnt.
Run C# code.
<script language="C#">
<code><![CDATA[
public static void ScriptMain(Project project) {
System.Console.WriteLine("Hello World from a script task using C#");
}
]]></code>
</script>
Run Visual Basic.NET code.
<script language="VB">
<code><![CDATA[
Public Shared Sub ScriptMain(project As Project)
System.Console.WriteLine("Hello World from a script task using Visual Basic.NET")
End Sub
]]></code>
</script>
The language of the script block (VB, C# or JS).
Any required references.
The name of the main class containing the static ScriptMain entry point.
A task for sleeping a specified period of time, useful when a build or deployment process
requires an interval between tasks.
Sleep 1 hour, 2 minutes, 3 seconds and 4 milliseconds.
]]>
Sleep 123 milliseconds.
]]>
Return time to sleep.
Sleep the specified number of milliseconds.
Milliseconds to sleep.
Verify parameters.
taskNode used to define this task instance
Hours to add to the sleep time.
Minutes to add to the sleep time.
Seconds to add to the sleep time.
Milliseconds to add to the sleep time.
Process a document via XSLT.
This is useful for building views of XML based documentation, or in generating code.
Create a report in HTML.
<style style="report.xsl" in="data.xml" out="report.html" />
taskNode used to define this task instance
Where to find the source XML file, default is the project's basedir.
Directory in which to store the results.
Desired file extension to be used for the targets. The default is "html".
Name of the stylesheet to use - given either relative to the project's basedir or as an absolute path.
Specifies a single XML document to be styled. Should be used with the out attribute.
Specifies the output name for the styled result from the in attribute.
Set properties with system information.
Sets a number of properties with information about the system environment. The intent of this task is for nightly build logs to have a record of system information so that the build was performed on.
Property Value
- sys.clr.version Common Language Runtime version number.
- sys.env.* Environment variables (e.g., sys.env.PATH).
- sys.os.folder.systemThe System directory.
- sys.os.folder.temp The temporary directory.
- sys.os.platform Operating system platform ID.
- sys.os.version Operating system version.
- sys.os Operating system version string.
Register the properties with the default property prefix.
<sysinfo/>
Register the properties without a prefix.
<sysinfo prefix=""/>
Register properties and display a summary
<sysinfo verbose="true"/>
The string to prefix the property names with. Default is "sys."
Touch a file and/or fileset(s) -- corresponds to the Unix touch command.
Touch the Main.cs file. The current time is used.
]]>
Touch all executable files in the current directory and its subdirectories.
]]>
Initializes task and ensures the supplied attributes are valid.
Xml node used to define this task instance.
Assembly Filename (required unless a fileset is specified).
Specifies the new modification time of the file in milliseconds since midnight Jan 1 1970.
Specifies the new modification time of the file in the format MM/DD/YYYY HH:MM AM_or_PM.
Fileset to use instead of single file.
Sets properties with the current date and time.
By default tstamp displays the current date and time and sets the following properties:
- tstamp.date to yyyyMMdd
- tstamp.time to HHmm
- tstamp.now using the default DateTime.ToString() method
To set an additional property with a custom date/time use the property and pattern attributes. To set a number of additional properties all with the exact same date and time use the formatter nested element (see example).
The date and time string displayed the tstamp uses the computer's default long date and time string format. You might consider setting these to the ISO 8601 standard for date and time notation.
Set the build.date property.
]]>
Set a number of properties for for Ant like compatibility.
]]>
The property to receive the date/time string in the given pattern.
The date/time pattern to be used.
The following table lists the standard format characters for each standard pattern. The format characters are case-sensitive; for example, 'g' and 'G' represent slightly different patterns.
Format Character
Description Example Format Pattern (en-US)
- dMM/dd/yyyy
- Ddddd, dd MMMM yyyy
- fdddd, dd MMMM yyyy HH:mm
- Fdddd, dd MMMM yyyy HH:mm:ss
- gMM/dd/yyyy HH:mm
- GMM/dd/yyyy HH:mm:ss
- m, MMMMM dd
- r, Rddd, dd MMM yyyy HH':'mm':'ss 'GMT'
- syyyy'-'MM'-'dd'T'HH':'mm':'ss
- tHH:mm
- THH:mm:ss
- uyyyy'-'MM'-'dd HH':'mm':'ss'Z'
- Udddd, dd MMMM yyyy HH:mm:ss
- y, Yyyyy MMMM
The following table lists the patterns that can be combined to construct custom patterns. The patterns are case-sensitive; for example, "MM" is recognized, but "mm" is not. If the custom pattern contains white-space characters or characters enclosed in single quotation marks, the output string will also contain those characters. Characters not defined as part of a format pattern or as format characters are reproduced literally.
Format
Pattern Description
- dThe day of the month. Single-digit days will not have a leading zero.
- ddThe day of the month. Single-digit days will have a leading zero.
- dddThe abbreviated name of the day of the week.
- ddddThe full name of the day of the week.
- MThe numeric month. Single-digit months will not have a leading zero.
- MMThe numeric month. Single-digit months will have a leading zero.
- MMMThe abbreviated name of the month.
- MMMMThe full name of the month.
- yThe year without the century. If the year without the century is less than 10, the year is displayed with no leading zero.
- yyThe year without the century. If the year without the century is less than 10, the year is displayed with a leading zero.
- yyyyThe year in four digits, including the century.
- ggThe period or era. This pattern is ignored if the date to be formatted does not have an associated period or era string.
- hThe hour in a 12-hour clock. Single-digit hours will not have a leading zero.
- hhThe hour in a 12-hour clock. Single-digit hours will have a leading zero.
- HThe hour in a 24-hour clock. Single-digit hours will not have a leading zero.
- HHThe hour in a 24-hour clock. Single-digit hours will have a leading zero.
- mThe minute. Single-digit minutes will not have a leading zero.
- mmThe minute. Single-digit minutes will have a leading zero.
- sThe second. Single-digit seconds will not have a leading zero.
- ssThe second. Single-digit seconds will have a leading zero.
- fThe fraction of a second in single-digit precision. The remaining digits are truncated.
- ffThe fraction of a second in double-digit precision. The remaining digits are truncated.
- fffThe fraction of a second in three-digit precision. The remaining digits are truncated.
- ffffThe fraction of a second in four-digit precision. The remaining digits are truncated.
- fffffThe fraction of a second in five-digit precision. The remaining digits are truncated.
- ffffffThe fraction of a second in six-digit precision. The remaining digits are truncated.
- fffffffThe fraction of a second in seven-digit precision. The remaining digits are truncated.
- tThe first character in the AM/PM designator.
- ttThe AM/PM designator.
- zThe time zone offset ("+" or "-" followed by the hour only). Single-digit hours will not have a leading zero. For example, Pacific Standard Time is "-8".
- zzThe time zone offset ("+" or "-" followed by the hour only). Single-digit hours will have a leading zero. For example, Pacific Standard Time is "-08".
- zzzThe full time zone offset ("+" or "-" followed by the hour and minutes). Single-digit hours and minutes will have leading zeros. For example, Pacific Standard Time is "-08:00".
- :The default time separator.
- /The default date separator.
- \ cPattern Where c is any character. Displays the character literally. To display the backslash character, use "\\".
The property to set.
The string pattern to use to format the property.
Compiles Microsoft Visual Basic.NET programs using vbc.exe.
Example build file using this task.
]]>
Writes the compiler options to the specified TextWriter.
Specifies whether /baseaddress option gets passed to the compiler.
See the Microsoft.NET Framework SDK documentation for details.
The value of this property is a string that makes up a 32bit hexidecimal number.
Specifies whether the /imports option gets passed to the compiler
See the Microsoft.NET Framework SDK documentation for details.
The value of this attribute is a string that contains one or more namespaces separated by commas.
Example of an imports attribute
Specifies whether /optioncompare option gets passed to the compiler
See the Microsoft.NET Framework SDK documentation for details.
The value of this property must be either text, binary, or an empty string. If the value is false or empty string, the switch is omitted.
Specifies whether the /optionexplicit option gets passed to the compiler.
See the Microsoft.NET Framework SDK documentation for details.
The value of this attribute must be either true or false. If false, the switch is omitted.
Specifies whether the /optionstrict option gets passed to the compiler.
See the Microsoft.NET Framework SDK documentation for details.
The value of this attribute must be either true or false. If false, the switch is omitted.
Specifies whether the /removeintchecks option gets passed to the compiler.
See the Microsoft.NET Framework SDK documentation for details.
The value of this attribute must be either true or false. If false, the switch is omitted.
Specifies whether the /rootnamespace option gets passed to the compiler.
See the Microsoft.NET Framework SDK documentation for details.
The value of this attribute is a string that contains the root namespace of the project.
A task to create a zip file from a specified fileset.
Uses NZipLib, an open source Zip/GZip library written entirely in C#.
Zip all files in the subdirectory build to backup.zip.
]]>
The zip file to create.
Desired level of compression (default is 6).
0 - 9 (0 - STORE only, 1-9 DEFLATE (1-lowest, 9-highest))
The set of files to be included in the archive.
The standard logger that will suffice for any command line based nant runner.
Used for test classes to check output.
Returns the contents of log captured.
Provides a set of methods and properties that log the execution of the build process. This class cannot be inherited.
Flushes the output buffer, and causes buffered data to be written to the Listeners.
Increases the current IndentLevel by one.
Decreases the current IndentLevel by one.
Indents the message if needed.
Writes the given message to the log.
Writes the given message to the log.
Writes the given message to the log if condition is true.
Writes the given message to the log if condition is true.
Writes the given message to the log.
Writes the given message to the log.
Writes the given message to the log.
Writes the given message to the log if condition is true.
Writes the given message to the log if condition is true.
Gets or sets whether Flush should be called on the Listeners after every write.
Gets or sets the indent level. Default is zero.
Gets or sets the number of spaces in an indent. Default is four.
Gets the collection of listeners that is monitoring the log output.
Thrown whenever an error occurs during the build.
Constructs a build exception with no descriptive information.
Constructs an exception with a descriptive message.
Constructs an exception with a descriptive message and an
instance of the Exception that is the cause of the current Exception.
Constructs an exception with a descriptive message and location
in the build file that caused the exception.
The error message that explains the reason for the exception.
Location in the build file where the exception occured.
Constructs an exception with the given descriptive message, the
location in the build file and an instance of the Exception that
is the cause of the current Exception.
The error message that explains the reason for the exception.
Location in the build file where the exception occured.
An instance of Exception that is the cause of the current Exception.
Initializes a new instance of the BuildException class with serialized data.
Sets the SerializationInfo object with information about the exception.
The object that holds the serialized object data.
The contextual information about the source or destination.
For more information, see SerializationInfo in the Microsoft documentation.
Used for searching file system based on given include/exclude rules.
Simple client code for testing the class.
while(true) {
DirectoryScanner scanner = new DirectoryScanner();
Console.Write("Scan Basedirectory : ");
string s = Console.ReadLine();
if (s == "") break;
scanner.BaseDirectory = s;
while(true) {
Console.Write("Include pattern : ");
s = Console.ReadLine();
if (s == "") break;
scanner.Includes.Add(s);
}
while(true) {
Console.Write("Exclude pattern : ");
s = Console.ReadLine();
if (s == "") break;
scanner.Excludes.Add(s);
}
foreach (string name in scanner.FileNames)
Console.WriteLine("file:" + name);
foreach (string name in scanner.DirectoryNames)
Console.WriteLine("dir :" + name);
Console.WriteLine("");
}
Added support for absolute paths and relative paths refering to parent directories ( ../ )
Changed implementation because of performance reasons - now scanning each directory only once
Use Includes and Excludes search criteria (relative to Basedirectory or absolute) to search for filesystem objects
Totally changed the scanning strategy
Changed it again because of performance reasons
Parses given NAnt search patterns for search directories and corresponding regex patterns
In. NAnt patterns. Absolute or relative paths.
Out. Regex patterns. Absolute canonical paths.
Created
Given a NAnt search pattern returns a search directory and an regex search pattern.
NAnt searh pattern (relative to the Basedirectory OR absolute, relative paths refering to parent directories ( ../ ) also supported)
Out. Absolute canonical path to the directory to be searched
Out. Regex search pattern (absolute canonical path)
Created
Returning absolute regex patterns instead of relative nant patterns
Searches a directory recursively for files and directories matching the search criteria
Directory in which to search (absolute canonical path)
Checking if the directory has already been scanned
Converts NAnt search pattern to a regular expression pattern
Base directory for the search
Search pattern relative to the search directory
Regular expresssion (absolute path) for searching matching file/directory names
Added parameter baseDir, using it instead of class member variable
Determines if a file has a more recent last write time than the given time.
A collection of filenames to check last write times against.
The datetime to compare against.
The name of the first file that has a last write time greater than targetLastWriteTime; otherwise null.
Indicates whether default excludes should be used or not. Default "true".
The base of the directory of this file set. Default is project base directory.
The collection of file names that match the file set.
The pattern or file name to include.
If true then the pattern will be included; otherwise skipped. Default is "true".
Opposite of if. If false then the pattern will be included; otherwise skipped. Default is "false".
If true then the file name will be added to the file set without pattern matching or checking if the file exists.
If true then the file will be searched for on the path.
Stores the file name, line number and column number to record a position in a text file.
Creates a location consisting of a file name, line number and column number.
fileName can be a local URI resource, e.g., file:///C:/WINDOWS/setuplog.txt
Creates a location consisting of a file name.
fileName can be a local URI resource, e.g., file:///C:/WINDOWS/setuplog.txt
Creates an "unknown" location.
Private Init function.
Returns the file name, line number and a trailing space. An error
message can be appended easily. For unknown locations, returns
an empty string.
Gets a string containing the file name for the location.
The file name includes both the file path and the extension.
Gets the line number for the location.
Lines start at 1. Will be zero if not specified.
Gets the column number for the location.
Columns start a 1. Will be zero if not specified.
Maps XML nodes to the text positions from their original source.
Add a XmlDocument to the map.
A document can only be added to the map once.
Return the in the xml file for the given node.
The node passed in must be from a XmlDocument that has been added to the map.
Used to search for files on the PATH. The local directory is
not searched (since this would already be covered by normal use of
the includes element). Also, advanced pattern matching isn't supported
here: you need to know the exact name of the file.
Adds a file to the list to be scanned
The filename to add to the list
Central representation of an NAnt project.
The Run method will initialize the project with the build file specified in the BuildFile property and execute the default target.
If no target is given the default target will be executed if specified in the project.
Constructs a new Project with the given document.
Any valid build format will do.
Constructs a new Project with the given source.
The Source should be the full path to the build file.
This can be of any form that XmlDocument.Load(string url) accepts.
Inits stuff:
TaskFactory: Calls Initialize and AddProject
Log.IndentSize set to 12
Project properties are initialized ("nant.* stuff set")
NAnt Props:
- nant.filename
- nant.version
- nant.location
- nant.project.name
- nant.project.buildfile (if doc has baseuri)
- nant.project.basedir
- nant.project.default = defaultTarget
- nant.tasks.[name] = true
- nant.tasks.[name].location = AssemblyFileName
The Project Document.
Creates a new XmlDocument based on the project definition.
The source of the document. Any form that is valid for XmlDocument.Load(string url) can be used here.
The project document.
Executes the default target.
No top level error handling is done. Any BuildExceptions will make it out of this method.
Executes a specific target, and only that target.
target name to execute.
Only the target is executed. No global tasks are executed.
Does Execute() and wraps in error handling and time stamping.
Indication of success
This method is only meant to be used by the class and .
Creates a new Task from the given XmlNode
The task definition.
The new Task instance
Creates a new Task from the given XmlNode within a Target
The task definition.
The owner Target
The new Task instance
Expands a string from known properties
The string with replacement tokens
The expanded and replaced string
Combine with project's to form a full path to file or directory.
If it is possible for the path to contain property macros the path call first.
A rooted pathcomplete If the path is null the project's task does not have the concept of turning file attributes off. Instead you specify all the attributes that you want turned on and the rest are turned off by default.
If the path is null the project's task does not have the concept of turning file attributes off. Instead you specify all the attributes that you want turned on and the rest are turned off by default.
Refer to the FileAttributes enumeration in the .NET SDK for more information about file attributes.
The name of the project.
The Base Directory used for relative references.
The URI form of the current Document
If the build document is not file backed then null will be returned.
Returns the active build file
Used only if BuildTargets collection is empty.
When true tasks should output more build log messages.
The list of targets to built.
Targets are built in the order they appear in the collection. If the collection is empty the default target will be built.
The NAnt Properties.
This is the collection of Properties that are defined by the system and property task statements.
These properties can be used in expansion.
The targets defined in the this project. (RO Collection)
Maintains a list of the property names that are readonly.
Adds a property that cannot be changed.
Properties added with this method can never be changed. Note that
they are removed if the Clear method is called.
Name of property
Value of property
Adds a property to the collection.
Name of property
Value of property
Returns true if a property is listed as read only
Property to check
true if readonly, false otherwise
Inherits Properties from an existing property
dictionary Instance
Property list to inherit
The source xml representing this target.
Executes dependent targets first, then the target.
Creates a deep copy by calling Copy().
Creates a new (deep) copy.
A copy with the _hasExecuted set to false. This allows the new Target to be Executed.
The name of the target.
Hides to have Target return the name of target, not the name of Xml element - which would always be target.
If true then the target will be executed; otherwise skipped. Default is "true".
Opposite of if. If false then the target will be executed; otherwise skipped. Default is "false".
The Target Description
The space sep list of targets that this target depends on.
Indicates if the target has been executed.
Targets that have been executed will not execute a second time.
A collection of target names that must be executed before this target.
The TaskFactory comprises all of the loaded, and available, tasks. Use these static methods to register, initialize and create a task.
Initializes the tasks in the executing assembly, and basedir of the current domain.
Scans the path for any Tasks assemblies and adds them.
The directory to scan in.
Adds any Task Assemblies in the Project.BaseDirectory.
The project to work from.
Scans the given assembly for any classes derived from Task and adds a new builder for them.
The Assembly containing the new tasks to be loaded.
The count of tasks found in the assembly.
Creates a new Task instance for the given xml and project.
The XML to initialize the task with.
The Project that the Task belongs to.
The Task instance.
Returns the list of loaded TaskBuilders