Function Reference

Assembly Functions

Functions Summary
assembly::get-attribute-property

Gets a custom attribute from the specified assembly.

assembly::get-full-name

Gets the full name of the assembly, also known as the display name.

assembly::get-informational-version

Gets the value of the System.Reflection.AssemblyInformationalVersionAttribute for the specified assembly.

assembly::get-location

Gets the physical location, in codebase format, of the loaded file that contains the manifest.

assembly::get-name

Gets an System.Reflection.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 System.Reflection.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

Functions Summary
bool::parse

Converts the specified string representation of a logical value to its bool equivalent.

bool::to-string

Converts the specified bool to its equivalent string representation.

convert::to-boolean

Converts the argument to a boolean

Obsolete. Use type-specific conversion functions instead.
convert::to-datetime

Converts the argument to a datetime.

Obsolete. Use type-specific conversion functions instead.
convert::to-double

Converts the argument to double

Obsolete. Use type-specific conversion functions instead.
convert::to-int

Converts the argument to an integer.

Obsolete. Use type-specific conversion functions instead.
convert::to-string

Converts the argument to a string.

Obsolete. Use type-specific conversion functions instead.
datetime::format-to-string

Converts the specified System.DateTime to its equivalent string representation.

datetime::parse

Converts the specified string representation of a date and time to its System.DateTime equivalent.

datetime::to-string

Converts the specified System.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 int 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 long to its equivalent string representation.

timespan::parse

Constructs a System.TimeSpan from a time indicated by a specified string.

timespan::to-string

Converts the specified System.TimeSpan to its equivalent string representation.

version::parse

Converts the specified string representation of a version to its System.Version equivalent.

version::to-string

Converts the specified System.Version to its equivalent string representation.

Date/Time Functions

Functions 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 System.DateTime that is the current local date and time on this computer.

timespan::from-days

Returns a System.TimeSpan that represents a specified number of days, where the specification is accurate to the nearest millisecond.

timespan::from-hours

Returns a System.TimeSpan that represents a specified number of hours, where the specification is accurate to the nearest millisecond.

timespan::from-milliseconds

Returns a System.TimeSpan that represents a specified number of milliseconds.

timespan::from-minutes

Returns a System.TimeSpan that represents a specified number of minutes, where the specification is accurate to the nearest millisecond.

timespan::from-seconds

Returns a System.TimeSpan that represents a specified number of seconds, where the specification is accurate to the nearest millisecond.

timespan::from-ticks

Returns a System.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 System.TimeSpan.

timespan::get-hours

Returns the number of whole hours represented by the specified System.TimeSpan.

timespan::get-milliseconds

Returns the number of whole milliseconds represented by the specified System.TimeSpan.

timespan::get-minutes

Returns the number of whole minutes represented by the specified System.TimeSpan.

timespan::get-seconds

Returns the number of whole seconds represented by the specified System.TimeSpan.

timespan::get-ticks

Returns the number of ticks contained in the specified System.TimeSpan.

timespan::get-total-days

Returns the total number of days represented by the specified System.TimeSpan, expressed in whole and fractional days.

timespan::get-total-hours

Returns the total number of hours represented by the specified System.TimeSpan, expressed in whole and fractional hours.

timespan::get-total-milliseconds

Returns the total number of milliseconds represented by the specified System.TimeSpan, expressed in whole and fractional milliseconds.

timespan::get-total-minutes

Returns the total number of minutes represented by the specified System.TimeSpan, expressed in whole and fractional minutes.

timespan::get-total-seconds

Returns the total number of seconds represented by the specified System.TimeSpan, expressed in whole and fractional seconds.

Directory Functions

Functions 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-name

Retrieves the directory name of the specified path.

directory::get-parent-directory

Retrieves the parent directory of the specified path.

Environment Functions

Functions 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 System.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 System.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

Functions 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

Functions 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

MSBuild Functions

Functions Summary
msbuild::is-msbuild-project

Test whether project is VS2005 project and could be built using <msbuild>

NAnt Functions

Functions 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 specified framework.

framework::get-clr-version

Gets the Common Language Runtime version of the current target 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 NAnt.Core.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 specified framework.

framework::get-version

Gets the version of the current target 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.

nant::scan-probing-paths

Searches the probing paths of the current target framework for the specified file.

nant::scan-probing-paths

Searches the probing paths of the current target framework for the specified file.

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).

Obsolete. Use the is-windows function instead.
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 System.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 System.Reflection.Assembly from which the specified task was loaded.

Operating System Functions

Functions Summary
operating-system::get-platform

Gets a System.PlatformID value that identifies the operating system platform.

operating-system::get-version

Gets a System.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

Functions 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

Functions 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

Functions 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

Functions 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 System.Diagnostics.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.