Note: This is the migration API reference for FAKE 5. The new (modularized) API documentation can be found here. If the API is already migrated you can check here if exists in a module. More information regarding the migration can be found here

Environment

Nested types and modules

TypeDescription
EnvironTarget

Type alias for System.EnvironmentVariableTarget

MachineDetails
OBSOLETE

Will no longer be available in dotnetcore, target package is currently unknown

A record which allows to display lots of machine specific information like machine name, processor count etc.

ModuleDescription
Internal

Functions and values

Function or valueDescription
Environment.clearEnvironVar(name)
Signature: name:string -> unit

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

Environment.environVar(name)
Signature: name:string -> string

Retrieves the environment variable with the given name

Environment.environVarAsBool(varName)
Signature: varName:string -> bool

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

Environment.environVarAsBoolOrDefault(...)
Signature: varName:string -> defaultValue:bool -> bool

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

Environment.environVarOrDefault(...)
Signature: name:string -> defaultValue:string -> string

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

Environment.environVarOrFail(name)
Signature: name:string -> string

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

Environment.environVarOrNone(name)
Signature: name:string -> string option

Retrieves the environment variable or None

Environment.environVars()
Signature: unit -> (string * string) list

Retrieves all environment variables from the given target

Environment.environVarsWithMode(mode)
Signature: mode:EnvironmentVariableTarget -> (obj * obj) list
Attributes:
[<Obsolete("Will be removed in dotnetcore. Use environVars instead.")>]
OBSOLETE

Will be removed in dotnetcore. Use environVars instead.

Environment.getBuildParam(name)
Signature: name:string -> string
Attributes:
[<Obsolete("Use 'environVarOrDefault name String.Empty' instead")>]
OBSOLETE

Use 'environVarOrDefault name String.Empty' instead

Returns the value of the build parameter with the given name if it was set and otherwise an empty string

Environment.getBuildParamOrDefault(...)
Signature: name:string -> defaultParam:string -> string
Attributes:
[<Obsolete("Use environVarOrDefault instead")>]
OBSOLETE

Use environVarOrDefault instead

Returns the value of the build parameter with the given name if it was set and otherwise the given default value

Environment.getDefaultEncoding()
Signature: unit -> Encoding

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

Environment.getDrivesInfo()
Signature: unit -> seq<string>
Attributes:
[<Obsolete("Will no longer be available in dotnetcore, target package is currently unknown")>]
OBSOLETE

Will no longer be available in dotnetcore, target package is currently unknown

Retrieves information about the hard drives

Environment.getInstalledDotNetFrameworks(...)
Signature: unit -> seq<string>
Attributes:
[<Obsolete("Will no longer be available in dotnetcore, target package is currently unknown")>]
OBSOLETE

Will no longer be available in dotnetcore, target package is currently unknown

Returns a sequence with all installed .NET framework versions

Environment.getMachineEnvironment()
Signature: unit -> MachineDetails
Attributes:
[<Obsolete("Will no longer be available in dotnetcore, target package is currently unknown")>]
OBSOLETE

Will no longer be available in dotnetcore, target package is currently unknown

Retrieves lots of machine specific information like machine name, processor count etc.

Environment.getNewestTool(...)
Signature: possibleToolPaths:seq<'?18479> -> '?18479
Type parameters: '?18479

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

Environment.getTargetPlatformDir(...)
Signature: platformVersion:string -> string

Gets the local directory for the given target platform

Environment.hasBuildParam(name)
Signature: name:string -> bool
Attributes:
[<Obsolete("Use hasEnvironVar instead")>]
OBSOLETE

Use hasEnvironVar instead

Returns if the build parameter with the given name was set

Environment.hasEnvironVar(name)
Signature: name:string -> bool

Returns if the build parameter with the given name was set

Environment.isDotnetCore
Signature: bool
Attributes:
[<Obsolete("Use isDotNetCore instead (different casing of 'N')")>]
OBSOLETE

Use isDotNetCore instead (different casing of 'N')

Environment.isDotNetCore
Signature: bool
Environment.isLinux
Signature: bool

Determines if the current system is a Linux system

Environment.isMacOS
Signature: bool

Determines if the current system is a MacOs system

Environment.isMono
Signature: bool

Determines if the current FAKE runner is being run via mono. With the FAKE 5 runner, this will always be false Todo: Detect mono on windows

Environment.isUnix
Signature: bool

Determines if the current system is an Unix system. See http://www.mono-project.com/docs/faq/technical/#how-to-detect-the-execution-platform

Environment.isWindows
Signature: bool

Determines if the current system is a Windows system

Environment.monoPath
Signature: string
Environment.monoVersion
Signature: (string * Version option) option

required sometimes to workaround mono crashes http://stackoverflow.com/a/8414517/1269722 Note: 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

Environment.pathDirectories
Signature: seq<string>

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

Environment.ProgramFiles
Signature: string

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

Environment.ProgramFilesX86
Signature: 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

Environment.sdkBasePath
Signature: string

Base path for getting tools from windows SDKs

Environment.setBuildParam name value
Signature: name:string -> value:string -> unit
Attributes:
[<Obsolete("Use setEnvironVar instead")>]
OBSOLETE

Use setEnvironVar instead

Sets the build parameter with the given name for the current process.

Environment.setEnvironVar name value
Signature: name:string -> value:string -> unit

Sets the environment variable with the given name

Environment.splitEnvironVar(name)
Signature: name:string -> string list

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

Environment.SystemRoot
Signature: string

The system root environment variable. Typically "C:\Windows"