EnvironmentAliases.

EnvironmentVariables(ICakeContext) Method

Summary

Retrieves all environment variables.
Namespace
Cake.Common
Containing Type
EnvironmentAliases

Syntax

[CakeMethodAlias]
[CakeAliasCategory("Environment Variables")]
public static IDictionary<string, string> EnvironmentVariables(this ICakeContext context)

Examples

 var envVars = EnvironmentVariables();

 string path;
 if (envVars.TryGetValue("PATH", out path))
 {
     Information("Path: {0}", path);
 }

 foreach(var envVar in envVars)
 {
     Information(
         "Key: {0}\tValue: \"{1}\"",
         envVar.Key,
         envVar.Value
         );
 }

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.

Return Value

Type Description
IDictionary<string, string> The environment variables.