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

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

v5.fake.build

DotNet Module

.NET Core + CLI tools helpers

Types and nested modules

Type/Module Description

BuildConfiguration (Module)

THe build configuration for a DotNet application

CliChannel

Specifies the source channel for the installation.

Options (Module)

Versions

The a list of well-known versions to install

BuildConfiguration (Type)

build configuration

BuildOptions

dotnet build command options

CliArchitecture

.NET Core SDK architecture

CliInstallOptions

.NET Core SDK install options

CliVersion

.NET Core SDK version (used to specify version when installing .NET Core SDK)

FirstArgReplacement

InfoOptions

dotnet --info command options

InfoResult

dotnet info result

InstallerOptions

.NET Core SDK installer download options

MSBuildOptions

dotnet restore command options

NewLanguage

The languages supported by new command

NewOptions

dotnet new command options

NuGetPushOptions

nuget push parameters for dotnet nuget push

Options (Type)

dotnet cli command execution options

PackOptions

dotnet pack command options

PublishOptions

dotnet publish command options

RestoreOptions

dotnet restore command options

TemplateInstallOptions

dotnet new --install options

TemplateUninstallOptions

dotnet new --install options

TestOptions

dotnet test command options

Verbosity

dotnet restore verbosity

VersionOptions

dotnet --version command options

VersionResult

dotnet info result

Functions and values

Function or value Description

DotNet.build setParams project

Full Usage: DotNet.build setParams project

Parameters:

Execute dotnet build command

setParams : BuildOptions -> BuildOptions

set compile command parameters

project : string

project to compile

DotNet.defaultSystemInstallDir

Full Usage: DotNet.defaultSystemInstallDir

Returns: string

.NET Core SDK default install directory (set to default SDK installer paths (/usr/local/share/dotnet or C:\Program Files\dotnet))

Returns: string

DotNet.defaultUserInstallDir

Full Usage: DotNet.defaultUserInstallDir

Returns: string

.NET Core SDK default install directory (set to default SDK installer paths (%HOME/.dotnet or %LOCALAPPDATA%/Microsoft/dotnet).

Returns: string

DotNet.downloadInstaller setParams

Full Usage: DotNet.downloadInstaller setParams

Parameters:
Returns: string

Download .NET Core SDK installer

setParams : InstallerOptions -> InstallerOptions

set download installer options

Returns: string

DotNet.exec buildOptions command args

Full Usage: DotNet.exec buildOptions command args

Parameters:
    buildOptions : Options -> Options - build common execution options
    command : string - the sdk command to execute test, new, build, ...
    args : string - command arguments

Returns: ProcessResult

Execute raw dotnet cli command

buildOptions : Options -> Options

build common execution options

command : string

the sdk command to execute test, new, build, ...

args : string

command arguments

Returns: ProcessResult

DotNet.findPossibleDotnetCliPaths dotnetCliDir

Full Usage: DotNet.findPossibleDotnetCliPaths dotnetCliDir

Parameters:
    dotnetCliDir : string option - the path to check else will probe system PATH

Returns: seq<string>

Get dotnet cli executable path. Probes the provided path first, then as a fallback tries the system PATH

dotnetCliDir : string option

the path to check else will probe system PATH

Returns: seq<string>

DotNet.getSDKVersionFromGlobalJson ()

Full Usage: DotNet.getSDKVersionFromGlobalJson ()

Parameters:
    () : unit

Returns: string

Gets the DotNet SDK from the global.json. This file can exist in the working directory or any of the parent directories

() : unit
Returns: string

DotNet.getVersion setParams

Full Usage: DotNet.getVersion setParams

Parameters:
Returns: string

Execute dotnet --version command

setParams : VersionOptions -> VersionOptions

set version command parameters

Returns: string

DotNet.info setParams

Full Usage: DotNet.info setParams

Parameters:
Returns: InfoResult

Execute dotnet --info command

setParams : InfoOptions -> InfoOptions

set info command parameters

Returns: InfoResult

DotNet.install setParams

Full Usage: DotNet.install setParams

Parameters:
Returns: Options -> Options

Install .NET Core SDK if required

setParams : CliInstallOptions -> CliInstallOptions

set installation options

Returns: Options -> Options

DotNet.installTemplate templateName setParams

Full Usage: DotNet.installTemplate templateName setParams

Parameters:

Execute dotnet new --install <PATH|NUGET_ID> command to install a new template

templateName : string

template short name to install

setParams : TemplateInstallOptions -> TemplateInstallOptions

set version command parameters

DotNet.msbuild setParams project

Full Usage: DotNet.msbuild setParams project

Parameters:
    setParams : MSBuildOptions -> MSBuildOptions - A function that overwrites the default MSBuildOptions
    project : string - A string with the path to the project file to build.

Runs a MSBuild project

setParams : MSBuildOptions -> MSBuildOptions

A function that overwrites the default MSBuildOptions

project : string

A string with the path to the project file to build.

Example


 open Fake.DotNet
     let setMsBuildParams (defaults:MSBuild.CliArguments) =
             { defaults with
                 Verbosity = Some(Quiet)
                 Targets = ["Build"]
                 Properties =
                     [
                         "Optimize", "True"
                         "DebugSymbols", "True"
                         "Configuration", "Release"
                     ]
              }
     let setParams (defaults:DotNet.MSBuildOptions) =
             { defaults with
                 MSBuildParams = setMsBuildParams defaults.MSBuildParams
              }

     DotNet.msbuild setParams "./MySolution.sln"

DotNet.newFromTemplate templateName setParams

Full Usage: DotNet.newFromTemplate templateName setParams

Parameters:
    templateName : 'a - template short name to create from
    setParams : NewOptions -> NewOptions - set version command parameters

Execute dotnet new command

templateName : 'a

template short name to create from

setParams : NewOptions -> NewOptions

set version command parameters

DotNet.nugetPush setParams nupkg

Full Usage: DotNet.nugetPush setParams nupkg

Parameters:

Execute dotnet nuget push command

setParams : NuGetPushOptions -> NuGetPushOptions

set nuget push command parameters

nupkg : string

nupkg to publish

Example


 open Fake.DotNet
     let setNugetPushParams (defaults:NuGet.NuGetPushParams) =
             { defaults with
                 DisableBuffering = true
                 ApiKey = Some "abc123"
              }
     let setParams (defaults:DotNet.NuGetPushOptions) =
             { defaults with
                 PushParams = setNugetPushParams defaults.PushParams
              }

     DotNet.nugetPush setParams "./My.Package.nupkg"

DotNet.pack setParams project

Full Usage: DotNet.pack setParams project

Parameters:

Execute dotnet pack command

setParams : PackOptions -> PackOptions

set pack command parameters

project : string

project to pack

Example


  let packConfiguration (defaults:DotNet.PackOptions) =
         { defaults with
               Configuration = DotNet.Debug
               OutputPath = Some "./packages"
               IncludeSymbols = true }

     DotNet.pack packConfiguration "./MyProject.csproj"

DotNet.prefixProcess buildOptions firstArgs c

Full Usage: DotNet.prefixProcess buildOptions firstArgs c

Parameters:
Returns: CreateProcess<'a>

Replace the current CreateProcess instance to run with dotnet.exe

buildOptions : Options -> Options

build common execution options

firstArgs : string list
c : CreateProcess<'a>
Returns: CreateProcess<'a>

DotNet.publish setParams project

Full Usage: DotNet.publish setParams project

Parameters:

Execute dotnet publish command

setParams : PublishOptions -> PublishOptions

set publish command parameters

project : string

project to publish

DotNet.restore setParams project

Full Usage: DotNet.restore setParams project

Parameters:

Execute dotnet restore command

setParams : RestoreOptions -> RestoreOptions

set restore command parameters

project : string

project to restore packages

DotNet.setupEnv install

Full Usage: DotNet.setupEnv install

Parameters:
    install : Options -> Options - The SDK to use (result of DotNet.install)

Setup the environment (PATH and DOTNET_ROOT) in such a way that started processes use the given dotnet SDK installation. This is useful for example when using fable, see issue #2405

install : Options -> Options

The SDK to use (result of DotNet.install)

DotNet.test setParams project

Full Usage: DotNet.test setParams project

Parameters:

Execute dotnet test command

setParams : TestOptions -> TestOptions

set test command parameters

project : string

project to test

DotNet.tryGetSDKVersionFromGlobalJson ()

Full Usage: DotNet.tryGetSDKVersionFromGlobalJson ()

Parameters:
    () : unit

Returns: string option

Tries the DotNet SDK from the global.json. This file can exist in the working directory or any of the parent directories Returns None if global.json is not found

() : unit
Returns: string option

DotNet.uninstallTemplate templateName

Full Usage: DotNet.uninstallTemplate templateName

Parameters:
    templateName : string - template short name to uninstall

Execute dotnet new --uninstall <PATH|NUGET_ID> command to uninstall a new template

templateName : string

template short name to uninstall