FAKE - F# Make - A DSL for build tasks and more FAKE
6.0.0

Lookig for older versions of the documentation, pre FAKE v6? See 

v5.fake.build

Environment Module

This module contains functions which allow to read and write environment variables and build parameters

Types and nested modules

Type/Module Description

Internal

EnvironTarget

Type alias for System.EnvironmentVariableTarget

Functions and values

Function or value Description

Environment.ProgramFiles

Full Usage: Environment.ProgramFiles

Returns: string

The path of the "Program Files" folder - might be x64 on x64 machine

Returns: string

Environment.ProgramFilesX86

Full Usage: Environment.ProgramFilesX86

Returns: string

The path of Program Files (x86) It seems this covers all cases where PROCESSOR\_ARCHITECTURE may misreport and the case where the other variable PROCESSOR\_ARCHITEW6432 can be null

Returns: string

Environment.SystemRoot

Full Usage: Environment.SystemRoot

Returns: string

The system root environment variable. Typically C:\Windows

Returns: string

Environment.clearEnvironVar name

Full Usage: Environment.clearEnvironVar name

Parameters:
    name : string - The name of the environment variable

Clears the environment variable with the given name for the current process.

name : string

The name of the environment variable

Environment.environVar name

Full Usage: Environment.environVar name

Parameters:
    name : string - The environment variable name

Returns: string

Retrieves the environment variable with the given name

name : string

The environment variable name

Returns: string

Environment.environVarAsBool varName

Full Usage: Environment.environVarAsBool varName

Parameters:
    varName : string - The name of the environment variable

Returns: bool

Retrieves the environment variable with the given name or returns the false if no value was set

varName : string

The name of the environment variable

Returns: bool

Environment.environVarAsBoolOrDefault varName defaultValue

Full Usage: Environment.environVarAsBoolOrDefault varName defaultValue

Parameters:
    varName : string
    defaultValue : bool - The default value to return if no value was set

Returns: bool

Retrieves the environment variable with the given name or returns the default bool if no value was set

varName : string
defaultValue : bool

The default value to return if no value was set

Returns: bool

Environment.environVarOrDefault name defaultValue

Full Usage: Environment.environVarOrDefault name defaultValue

Parameters:
    name : string - The name of the environment variable
    defaultValue : string - The default value to return if no value was set

Returns: string

Retrieves the environment variable with the given name or returns the default if no value was set

name : string

The name of the environment variable

defaultValue : string

The default value to return if no value was set

Returns: string

Environment.environVarOrFail name

Full Usage: Environment.environVarOrFail name

Parameters:
    name : string - The name of the environment variable

Returns: string

Retrieves the environment variable with the given name or fails if not found

name : string

The name of the environment variable

Returns: string

Environment.environVarOrNone name

Full Usage: Environment.environVarOrNone name

Parameters:
    name : string - The name of the environment variable

Returns: string option

Retrieves the environment variable or None

name : string

The name of the environment variable

Returns: string option

Environment.environVars ()

Full Usage: Environment.environVars ()

Parameters:
    () : unit

Returns: (string * string) list

Retrieves all environment variables from the given target

() : unit
Returns: (string * string) list

Environment.getDefaultEncoding ()

Full Usage: Environment.getDefaultEncoding ()

Parameters:
    () : unit

Returns: Encoding

Contains the IO encoding which is given via build parameter "encoding" or the default encoding if no encoding was specified.

() : unit
Returns: Encoding

Environment.getNewestTool possibleToolPaths

Full Usage: Environment.getNewestTool possibleToolPaths

Parameters:
    possibleToolPaths : seq<'a>

Returns: 'a

Helper function to help find framework or sdk tools from the newest toolkit available

possibleToolPaths : seq<'a>
Returns: 'a

Environment.getNuGetPackagesCacheFolder ()

Full Usage: Environment.getNuGetPackagesCacheFolder ()

Parameters:
    () : unit

Returns: string

Returns the path to the user-specific nuget packages folder

() : unit
Returns: string

Environment.getTargetPlatformDir platformVersion

Full Usage: Environment.getTargetPlatformDir platformVersion

Parameters:
    platformVersion : string

Returns: string

Gets the local directory for the given target platform

platformVersion : string
Returns: string

Environment.hasEnvironVar name

Full Usage: Environment.hasEnvironVar name

Parameters:
    name : string - The name of the environment variable

Returns: bool
Modifiers: inline

Returns if the build parameter with the given name was set

name : string

The name of the environment variable

Returns: bool

Environment.isDotNetCore

Full Usage: Environment.isDotNetCore

Returns: bool
Returns: bool

Environment.isLinux

Full Usage: Environment.isLinux

Returns: bool

Determines if the current system is a Linux system

Returns: bool

Environment.isMacOS

Full Usage: Environment.isMacOS

Returns: bool

Determines if the current system is a MacOs system

Returns: bool

Environment.isMono

Full Usage: Environment.isMono

Returns: bool

Determines if the current FAKE runner is being run via mono. With the FAKE 5 or above runner, this will always be false

Returns: bool

Environment.isUnix

Full Usage: Environment.isUnix

Returns: bool

Determines if the current system is an Unix system. See how-to-detect-the-execution-platform

Returns: bool

Environment.isWindows

Full Usage: Environment.isWindows

Returns: bool

Determines if the current system is a Windows system

Returns: bool

Environment.monoPath

Full Usage: Environment.monoPath

Returns: string
Returns: string

Environment.monoVersion

Full Usage: Environment.monoVersion

Returns: (string * Version option) option

Required sometimes to workaround mono crashes see this link Only given when we are running on mono, represents the version of the mono runtime we are currently running on. In netcore world you can retrieve the mono version in the environment (PATH) via Fake.Core.Process.Mono.monoVersion

Returns: (string * Version option) option

Environment.pathDirectories

Full Usage: Environment.pathDirectories

Returns: seq<string>

Gets the list of valid directories included in the PATH environment variable.

Returns: seq<string>

Environment.sdkBasePath

Full Usage: Environment.sdkBasePath

Returns: string

Base path for getting tools from windows SDKs

Returns: string

Environment.setEnvironVar name value

Full Usage: Environment.setEnvironVar name value

Parameters:
    name : string - The name of the environment variable to set
    value : string - The value of the environment variable to set

Sets the environment variable with the given name

name : string

The name of the environment variable to set

value : string

The value of the environment variable to set

Environment.splitEnvironVar name

Full Usage: Environment.splitEnvironVar name

Parameters:
    name : string - The name of the environment variable

Returns: string list

Splits the entries of an environment variable and removes the empty ones.

name : string

The name of the environment variable

Returns: string list