Task Reference
| Task | Summary |
|---|---|
| al | Wraps al.exe, the assembly linker for the .NET Framework. |
| asminfo | Generates an AssemblyInfo file using the attributes given. |
| attrib | Changes the file attributes of a file or set of files and directories. |
| available | Checks if a resource is available at runtime. |
| aximp | Generates a Windows Forms Control that wraps ActiveX Controls defined in an OCX. |
| call | Calls a NAnt target in the current project. |
| choose | Executes an alternate set of task or type definition depending on conditions that are individually set on each group. |
| cl | Compiles C/C++ programs using cl.exe, Microsoft's C/C++ compiler. |
| copy | Copies a file, a directory, or set of files to a new file or directory. |
| csc | Compiles C# programs. |
| cvs | Executes the cvs command specified by the command attribute. |
| cvs-changelog | Produces an XML report that represents the cvs changes from the given start day, to a given end date. |
| cvs-checkout | Checks out a CVS module to the required directory. |
| cvs-export | Exports a cvs module in preperation for a release (i.e. the CVS version folders are not exported). |
| cvs-pass | Executes the cvs login command which appends or updates an entry to the specified .cvspass file. |
| cvs-rtag | Tags all sources in the remote repository with a given tag. |
| cvs-tag | Tags all local sources with the specified tag. |
| cvs-update | Updates a CVS module in a local working directory. |
| delay-sign | Signs delay-signed .NET Assemblies, or re-signs existing assemblies. |
| delete | Deletes a file, fileset or directory. |
| description | An empty task that allows a build file to contain a description. |
| echo | Writes a message to the build log or a specified file. |
| exec | Executes a system command. |
| fail | Exits the current build by throwing a BuildException, optionally printing additional information. |
| foreach | Loops over a set of items. |
| get | Gets a particular file from a URL source. |
| gunzip | Expands a file packed using GZip compression. |
| if | Checks the conditional attributes and executes the children if true. |
| ifnot | The opposite of the if task. |
| ilasm | Compiles ILASM programs. |
| ildasm | Disassembles any portable executable (PE) file that contains intermediate language (IL) code. |
| include | Includes an external build file. |
| jsc | Compiles JScript.NET programs. |
| lib | Run lib.exe, Microsoft's Library Manager. |
| license | Generates a .licence file from a .licx file. |
| link | Links files using link.exe, Microsoft's Incremental Linker. |
| loadfile | Load a text file into a single property. |
| loadtasks | Loads tasks form a given assembly or all assemblies in a given directory or <fileset>. |
| Sends an SMTP message. | |
| mc | Compiles messages using mc.exe, Microsoft's Win32 message compiler. |
| midl | This tasks allows you to run MIDL.exe. |
| mkdir | Creates a directory and any non-existent parent directory if necessary. |
| move | Moves a file, a directory, or set of files to a new file or directory. |
| nant | Runs NAnt on a supplied build file, or a set of build files. |
| nantschema | Creates an XSD File for all available tasks. |
| ndoc | Runs NDoc V1.3.1 to create documentation. |
| nunit | Runs tests using the NUnit V1.0 framework. |
| nunit2 | Runs tests using the NUnit V2.6 framework. |
| property | Sets a property in the current project. |
| rc | Compiles resources using rc.exe, Microsoft's Win32 resource compiler. |
| readregistry | Reads a value or set of values from the Windows Registry into one or more NAnt properties. |
| regasm | Registers an assembly, or set of assemblies for use from COM clients. |
| regex | Sets project properties based on the evaluatuion of a regular expression. |
| regsvcs | Installs or removes .NET Services. |
| resgen | Converts files from one resource format to another. |
| script | Executes the code contained within the task. |
| servicecontroller | Allows a Windows service to be controlled. |
| setenv | Sets an environment variable or a whole collection of them. Use an empty value attribute to clear a variable. |
| sleep | A task for sleeping a specified period of time, useful when a build or deployment process requires an interval between tasks. |
| solution | Compiles VS.NET solutions (or sets of projects), automatically determining project dependencies from inter-project references. |
| style | Processes a document via XSLT. |
| sysinfo | Sets properties with system information. |
| tar | Creates a tar file from the specified filesets. |
| tlbexp | Exports a .NET assembly to a type library that can be used from unmanaged code (wraps Microsoft's tlbexp.exe). |
| tlbimp | Imports a type library to a .NET assembly (wraps Microsoft's tlbimp.exe). |
| touch | Touches a file or set of files -- corresponds to the Unix touch command. |
| trycatch | Executes a set of tasks, and optionally catches a build exception to allow recovery or rollback steps to be taken, or to define some steps to be taken regardless if the tasks succeed or fail, or both. |
| tstamp | Sets properties with the current date and time. |
| untar | Extracts files from a tar archive. |
| unzip | Extracts files from a zip archive. |
| uptodate | Check modification dates on groups of files. |
| vbc | Compiles Visual Basic.NET programs. |
| vjc | Compiles Visual J# programs using vjc, Microsoft's J# compiler. |
| xmlpeek | Extracts text from an XML file at the location specified by an XPath expression. |
| xmlpoke | Replaces text in an XML file at the location specified by an XPath expression. |
| zip | Creates a zip file from the specified filesets. |
Type Reference
| Type | Summary |
|---|---|
| assemblyfileset | Specialized <fileset> class for managing assembly files. |
| categories | Controls the categories of tests to execute using the <nunit2> task. |
| credential | Provides credentials for password-based authentication schemes. |
| cvsfileset | A <cvsfileset> is a <fileset> with extra attributes useful in the context of the <cvs> task. |
| dirset | A specialized <fileset> used for specifying a set of directories. |
| fileset | Filesets are groups of files. These files can be found in a directory tree starting in a base directory and are matched by patterns taken from a number of patterns. Filesets can appear inside tasks that support this feature or at the project level, i.e., as children of <project>. |
| filterchain | Represent a chain of NAnt filters that can be applied to a Task. |
| moduleset | One or more modules to compile into an assembly. |
| namespaceimports | Contains a collection of NamespaceImport items. |
| path | Paths are groups of files and/or directories that need to be passed as a single unit. The order in which parts of the path are specified in the build file is retained, and duplicate parts are automatically suppressed. |
| patternset | A set of patterns, mostly used to include or exclude certain files. |
| proxy | Contains HTTP proxy settings used to process requests to Internet resources. |
| resourcefileset | Specialized <fileset> class for managing resource files. |
| tarfileset | A <tarfileset> is a <fileset> with extra attributes useful in the context of the <tar> task. |
| warnaserror | Controls the behaviour of a compiler with regards to the reporting of warnings. |
| zipfileset | A <zipfileset> is a <fileset> with extra attributes useful in the context of the <zip> task. |
Function Reference
Assembly Functions
| Name | Summary |
|---|---|
| assembly::get-full-name | Gets the full name of the assembly, also known as the display name. |
| assembly::get-location | Gets the physical location, in codebase format, of the loaded file that contains the manifest. |
| assembly::get-name | Gets an AssemblyName for the specified assembly. |
| assembly::load | Loads an assembly given the long form of its name. |
| assembly::load-from-file | Loads an assembly given its file name or path. |
| assemblyname::get-assembly-name | Gets the AssemblyName for a given file. |
| assemblyname::get-codebase | Gets the location of the assembly as a URL. |
| assemblyname::get-escaped-codebase | Gets the URI, including escape characters, that represents the codebase. |
| assemblyname::get-full-name | Gets the full name of the assembly, also known as the display name. |
| assemblyname::get-name | Gets the simple, unencrypted name of the assembly. |
| assemblyname::get-version | Gets the version of the assembly. |
Conversion Functions
| Name | Summary |
|---|---|
| bool::parse | Converts the specified string representation of a logical value to its Boolean equivalent. |
| bool::to-string | Converts the specified Boolean to its equivalent string representation. |
| convert::to-boolean | Converts the argument to a boolean |
| convert::to-datetime | Converts the argument to a datetime. |
| convert::to-double | Converts the argument to double |
| convert::to-int | Converts the argument to an integer. |
| convert::to-string | Converts the argument to a string. |
| datetime::format-to-string | Converts the specified DateTime to its equivalent string representation. |
| datetime::parse | Converts the specified string representation of a date and time to its DateTime equivalent. |
| datetime::to-string | Converts the specified DateTime to its equivalent string representation. |
| double::parse | Converts the specified string representation of a number to its double-precision floating point number equivalent. |
| double::to-string | Converts the specified Double to its equivalent string representation. |
| int::parse | Converts the specified string representation of a number to its 32-bit signed integer equivalent. |
| int::to-string | Converts the specified Int32 to its equivalent string representation. |
| long::parse | Converts the specified string representation of a number to its 64-bit signed integer equivalent. |
| long::to-string | Converts the specified Int64 to its equivalent string representation. |
| timespan::parse | Constructs a TimeSpan from a time indicated by a specified string. |
| timespan::to-string | Converts the specified TimeSpan to its equivalent string representation. |
| version::parse | Converts the specified string representation of a version to its Version equivalent. |
| version::to-string | Converts the specified Version to its equivalent string representation. |
Date/Time Functions
| Name | Summary |
|---|---|
| datetime::get-day | Gets the day of the month represented by the specified date. |
| datetime::get-day-of-week | Gets the day of the week represented by the specified date. |
| datetime::get-day-of-year | Gets the day of the year represented by the specified date. |
| datetime::get-days-in-month | Returns the number of days in the specified month of the specified year. |
| datetime::get-hour | Gets the hour component of the specified date. |
| datetime::get-millisecond | Gets the milliseconds component of the specified date. |
| datetime::get-minute | Gets the minute component of the specified date. |
| datetime::get-month | Gets the month component of the specified date. |
| datetime::get-second | Gets the seconds component of the specified date. |
| datetime::get-ticks | Gets the number of ticks that represent the specified date. |
| datetime::get-year | Gets the year component of the specified date. |
| datetime::is-leap-year | Returns an indication whether the specified year is a leap year. |
| datetime::now | Gets a DateTime that is the current local date and time on this computer. |
| timespan::from-days | Returns a TimeSpan that represents a specified number of days, where the specification is accurate to the nearest millisecond. |
| timespan::from-hours | Returns a TimeSpan that represents a specified number of hours, where the specification is accurate to the nearest millisecond. |
| timespan::from-milliseconds | Returns a TimeSpan that represents a specified number of milliseconds. |
| timespan::from-minutes | Returns a TimeSpan that represents a specified number of minutes, where the specification is accurate to the nearest millisecond. |
| timespan::from-seconds | Returns a TimeSpan that represents a specified number of seconds, where the specification is accurate to the nearest millisecond. |
| timespan::from-ticks | Returns a TimeSpan that represents a specified time, where the specification is in units of ticks. |
| timespan::get-days | Returns the number of whole days represented by the specified TimeSpan. |
| timespan::get-hours | Returns the number of whole hours represented by the specified TimeSpan. |
| timespan::get-milliseconds | Returns the number of whole milliseconds represented by the specified TimeSpan. |
| timespan::get-minutes | Returns the number of whole minutes represented by the specified TimeSpan. |
| timespan::get-seconds | Returns the number of whole seconds represented by the specified TimeSpan. |
| timespan::get-ticks | Returns the number of ticks contained in the specified TimeSpan. |
| timespan::get-total-days | Returns the total number of days represented by the specified TimeSpan, expressed in whole and fractional days. |
| timespan::get-total-hours | Returns the total number of hours represented by the specified TimeSpan, expressed in whole and fractional hours. |
| timespan::get-total-milliseconds | Returns the total number of milliseconds represented by the specified TimeSpan, expressed in whole and fractional milliseconds. |
| timespan::get-total-minutes | Returns the total number of minutes represented by the specified TimeSpan, expressed in whole and fractional minutes. |
| timespan::get-total-seconds | Returns the total number of seconds represented by the specified TimeSpan, expressed in whole and fractional seconds. |
Directory Functions
| Name | Summary |
|---|---|
| directory::exists | Determines whether the given path refers to an existing directory on disk. |
| directory::get-creation-time | Returns the creation date and time of the specified directory. |
| directory::get-current-directory | Gets the current working directory. |
| directory::get-directory-root | Returns the volume information, root information, or both for the specified path. |
| directory::get-last-access-time | Returns the date and time the specified directory was last accessed. |
| directory::get-last-write-time | Returns the date and time the specified directory was last written to. |
| directory::get-parent-directory | Retrieves the parent directory of the specified path. |
DNS Functions
| Name | Summary |
|---|---|
| dns::get-host-name | Gets the host name of the local computer. |
Environment Functions
| Name | Summary |
|---|---|
| environment::get-folder-path | Gets the path to the system special folder identified by the specified enumeration. |
| environment::get-machine-name | Gets the NetBIOS name of this local computer. |
| environment::get-operating-system | Gets an OperatingSystem object that represents the current operating system. |
| environment::get-user-name | Gets the user name of the person who started the current thread. |
| environment::get-variable | Returns the value of the specified environment variable. |
| environment::get-version | Gets a Version object that describes the major, minor, build, and revision numbers of the Common Language Runtime. |
| environment::newline | Gets the newline string defined for this environment. |
| environment::variable-exists | Gets a value indicating whether the specified environment variable exists. |
File Functions
| Name | Summary |
|---|---|
| file::exists | Determines whether the specified file exists. |
| file::get-creation-time | Returns the creation date and time of the specified file. |
| file::get-last-access-time | Returns the date and time the specified file was last accessed. |
| file::get-last-write-time | Returns the date and time the specified file was last written to. |
| file::get-length | Gets the length of the file. |
| file::is-assembly | Checks if a given file is an assembly. |
| file::up-to-date | Determines whether targetFile is more or equal up-to-date than srcFile. |
Math Functions
| Name | Summary |
|---|---|
| math::abs | Returns the absolute value of the specified number |
| math::ceiling | Returns the smallest whole number greater than or equal to the specified number |
| math::floor | Returns the largest whole number less than or equal to the specified number. |
| math::round | Rounds the value to the nearest whole number |
NAnt Functions
| Name | Summary |
|---|---|
| framework::exists | Checks whether the specified framework exists, and is valid. |
| framework::get-assembly-directory | Gets the assembly directory of the specified framework. |
| framework::get-clr-version | Gets the Common Language Runtime version of the current target framework. |
| framework::get-clr-version | Gets the Common Language Runtime version of the specified framework. |
| framework::get-description | Gets the description of the current target framework. |
| framework::get-description | Gets the description of the specified framework. |
| framework::get-family | Gets the family of the specified framework. |
| framework::get-framework-directory | Gets the framework directory of the specified framework. |
| framework::get-frameworks | Gets a comma-separated list of frameworks filtered by the specified FrameworkTypes. |
| framework::get-runtime-engine | Gets the runtime engine of the specified framework. |
| framework::get-runtime-framework | Gets the identifier of the runtime framework. |
| framework::get-sdk-directory | Gets the SDK directory of the specified framework. |
| framework::get-target-framework | Gets the identifier of the current target framework. |
| framework::get-tool-path | Gets the absolute path of the specified tool for the current target framework. |
| framework::get-version | Gets the version of the current target framework. |
| framework::get-version | Gets the version of the specified framework. |
| framework::sdk-exists | Checks whether the SDK for the specified framework is installed. |
| nant::get-assembly | Gets the NAnt assembly. |
| nant::get-base-directory | Gets the base directory of the appdomain in which NAnt is running. |
| platform::get-name | Gets the name of the platform on which NAnt is running. |
| platform::is-unix | Checks whether NAnt is running on Unix. |
| platform::is-win32 | Checks whether NAnt is running on Windows (and not just 32-bit Windows as the name may lead you to believe). |
| platform::is-windows | Checks whether NAnt is running on Windows. |
| project::get-base-directory | Gets the base directory of the current project. |
| project::get-buildfile-path | Gets the local path to the build file. |
| project::get-buildfile-uri | Gets the Uri form of the build file. |
| project::get-default-target | Gets the name of the target that will be executed when no other build targets are specified. |
| project::get-name | Gets the name of the current project. |
| property::exists | Checks whether the specified property exists. |
| property::get-value | Gets the value of the specified property. |
| property::is-dynamic | Checks whether the specified property is a dynamic property. |
| property::is-readonly | Checks whether the specified property is read-only. |
| target::exists | Checks whether the specified target exists. |
| target::get-current-target | Gets the name of the target being executed. |
| target::has-executed | Checks whether the specified target has already been executed. |
| task::exists | Checks whether the specified task exists. |
| task::get-assembly | Returns the Assembly from which the specified task was loaded. |
Operating System Functions
| Name | Summary |
|---|---|
| operating-system::get-platform | Gets a PlatformID value that identifies the operating system platform. |
| operating-system::get-version | Gets a Version object that identifies this operating system. |
| operating-system::to-string | Converts the value of the specified operating system to its equivalent String representation. |
Path Functions
| Name | Summary |
|---|---|
| path::change-extension | Changes the extension of the path string. |
| path::combine | Combines two paths. |
| path::get-directory-name | Returns the directory information for the specified path string. |
| path::get-extension | Returns the extension for the specified path string. |
| path::get-file-name | Returns the filename for the specified path string. |
| path::get-file-name-without-extension | Returns the filename without extension for the specified path string. |
| path::get-full-path | Returns the fully qualified path. |
| path::get-path-root | Gets the root directory of the specified path. |
| path::get-temp-file-name | Returns a uniquely named zero-byte temporary file on disk and returns the full path to that file. |
| path::get-temp-path | Gets the path to the temporary directory. |
| path::has-extension | Determines whether a path string includes an extension. |
| path::is-path-rooted | Determines whether a path string is absolute. |
String Functions
| Name | Summary |
|---|---|
| string::contains | Tests whether the specified string contains the given search string. |
| string::ends-with | Tests whether the specified string ends with the specified suffix string. |
| string::get-length | Returns the length of the specified string. |
| string::index-of | Returns the position of the first occurrence in the specified string of the given search string. |
| string::last-index-of | Returns the position of the last occurrence in the specified string of the given search string. |
| string::pad-left | Returns the given string left-padded to the given length. |
| string::pad-right | Returns the given string right-padded to the given length. |
| string::replace | Returns a string corresponding to the replacement of a given string with another in the specified string. |
| string::starts-with | Tests whether the specified string starts with the specified prefix string. |
| string::substring | Returns a substring of the specified string. |
| string::to-lower | Returns the specified string converted to lowercase. |
| string::to-upper | Returns the specified string converted to uppercase. |
| string::trim | Returns the given string trimmed of whitespace. |
| string::trim-end | Returns the given string trimmed of trailing whitespace. |
| string::trim-start | Returns the given string trimmed of leading whitespace. |
Unix/Cygwin Functions
| Name | Summary |
|---|---|
| cygpath::get-dos-path | Gets the DOS (short) form of the specified path. |
| cygpath::get-unix-path | Gets the Unix form of the specified path. |
| cygpath::get-windows-path | Gets the Windows form of the specified path. |
| pkg-config::exists | Determines whether the given package exists. |
| pkg-config::get-compile-flags | Gets the compile flags required to compile the package, including all its dependencies. |
| pkg-config::get-link-flags | Gets the link flags required to compile the package, including all its dependencies. |
| pkg-config::get-mod-version | Determines the version of the given package. |
| pkg-config::get-variable | Gets the value of a variable for the specified package. |
| pkg-config::is-atleast-version | Determines whether the given package is at least version version. |
| pkg-config::is-between-version | Determines whether the given package is between two versions. |
| pkg-config::is-exact-version | Determines whether the given package is exactly version version. |
| pkg-config::is-max-version | Determines whether the given package is at no newer than version version. |
Version Functions
| Name | Summary |
|---|---|
| fileversioninfo::get-company-name | Gets the name of the company that produced the file. |
| fileversioninfo::get-file-version | Gets the file version of a file. |
| fileversioninfo::get-product-name | Gets the name of the product the file is distributed with. |
| fileversioninfo::get-product-version | Gets the product version of a file. |
| fileversioninfo::get-version-info | Returns a FileVersionInfo representing the version information associated with the specified file. |
| version::get-build | Gets the value of the build component of a given version. |
| version::get-major | Gets the value of the major component of a given version. |
| version::get-minor | Gets the value of the minor component of a given version. |
| version::get-revision | Gets the value of the revision component of a given version. |
Filter Reference
| Filter | Summary |
|---|---|
| expandproperties | Parses NAnt properties and expressions |
| replacestring | Replaces all occurrences of a given string in the original input with user-supplied replacement string. |
| replacetokens | Replaces tokens in the original input with user-supplied values. |
| tabstospaces | Converts tabs to spaces. |
以上内容引用自Nant官网:http://nant.sourceforge.net/
本文档提供了NAnt的任务、类型和函数参考,包括Assembly、Conversion、Date/Time、Directory等众多功能,是.NET开发者自动化构建的重要工具。

505

被折叠的 条评论
为什么被折叠?



