Note: This API documentation is for FAKE version 4. The migration API documentation can be found here. The API documentation for the new fake 5 modules can be found here

DotNetCli

Contains a task which can be used to run dotnet CLI commands.

Nested types and modules

TypeDescription
BuildParams

DotNet build parameters

CommandParams

DotNet parameters

PackParams

DotNet pack parameters

PublishParams

DotNet publish parameters

RestoreParams

DotNet restore parameters

TestParams

DotNet test parameters

Functions and values

Function or valueDescription
Build(setBuildParams)
Signature: setBuildParams:(BuildParams -> BuildParams) -> unit

Runs the dotnet "build" command.

Parameters

  • setBuildParams - Function used to overwrite the build default parameters.

Sample

1: 
2: 
3: 
4: 
DotNetCli.Build
  (fun p -> 
       { p with 
            Configuration = "Release" })
commandName
Signature: string

The dotnet command name

DotnetSDKPath
Signature: string
GetDotNetSDKVersionFromGlobalJson()
Signature: unit -> string

Gets the DotNet SDK from the global.json

getVersion()
Signature: unit -> string

Gets the installed dotnet version

InstallDotNetSDK(sdkVersion)
Signature: sdkVersion:string -> string

Installs the DotNet SDK locally to the given path

isInstalled()
Signature: unit -> bool

Checks wether the dotnet CLI is installed

Pack(setPackParams)
Signature: setPackParams:(PackParams -> PackParams) -> unit

Runs the dotnet "pack" command.

Parameters

  • setPackParams - Function used to overwrite the pack default parameters.

Sample

1: 
2: 
3: 
4: 
DotNetCli.Pack
  (fun p -> 
       { p with 
            Configuration = "Release" })
Publish(setPublishParams)
Signature: setPublishParams:(PublishParams -> PublishParams) -> unit

Runs the dotnet "publish" command.

Parameters

  • setPublishParams - Function used to overwrite the publish default parameters.

Sample

1: 
2: 
3: 
4: 
DotNetCli.Publish
  (fun p -> 
       { p with 
            Configuration = "Release" })
Restore(setRestoreParams)
Signature: setRestoreParams:(RestoreParams -> RestoreParams) -> unit

Runs the dotnet "restore" command.

Parameters

  • setRestoreParams - Function used to overwrite the restore default parameters.

Sample

1: 
2: 
3: 
4: 
DotNetCli.Restore 
    (fun p -> 
         { p with 
              NoCache = true })
RunCommand setCommandParams args
Signature: setCommandParams:(CommandParams -> CommandParams) -> args:string -> unit

Runs a dotnet command.

Parameters

  • setCommandParams - Function used to overwrite the default parameters.
  • args - command and additional arguments.

Sample

1: 
2: 
3: 
4: 
5: 
DotNetCli.RunCommand
    (fun p -> 
         { p with 
              TimeOut = TimeSpan.FromMinutes 10. })
    "restore"
SetVersionInProjectJson version fileName
Signature: version:string -> fileName:string -> unit

Sets version in project.json

Test(setTestParams)
Signature: setTestParams:(TestParams -> TestParams) -> unit

Runs the dotnet "test" command.

Parameters

  • setTestParams - Function used to overwrite the test default parameters.

Sample

1: 
2: 
3: 
4: 
DotNetCli.Test
  (fun p -> 
       { p with 
            Configuration = "Release" })