EnvironmentAliases.

HasEnvironmentVariable(ICakeContext, string) Method

Summary

Checks for the existence of a value for a given environment variable.
Namespace
Cake.Common
Containing Type
EnvironmentAliases

Syntax

[CakeMethodAlias]
[CakeAliasCategory("Environment Variables")]
public static bool HasEnvironmentVariable(this ICakeContext context, string variable)

Examples

if (HasEnvironmentVariable("SOME_ENVIRONMENT_VARIABLE"))
{
    Information("The environment variable was present.");
}

Attributes

Type Description
CakeMethodAliasAttribute An attribute used to mark script method aliases.
CakeAliasCategoryAttribute An attribute used for documentation of alias methods/properties.

Parameters

Name Type Description
context ICakeContext The context.
variable string The environment variable.

Return Value

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