EnvironmentFunctions.

VariableExists(string) Method

Summary

Gets a value indicating whether the specified environment variable exists.
Assembly
NAnt.Core.dll
Namespace
NAnt.Core.Functions
Containing Type
EnvironmentFunctions

Syntax

[Function("variable-exists")]
public static bool VariableExists(string name)

Examples

Execute a set of tasks only if the "BUILD_DEBUG" environment variable is set.

    <if test="${environment::variable-exists('BUILD_DEBUG')}">
    ...
</if>

Attributes

Type Description
FunctionAttribute Indicates that the method should be exposed as a function in NAnt build files.

Parameters

Name Type Description
name string The environment variable that should be checked.

Return Value

Type Description
bool true if the environment variable exists; otherwise, false.