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

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

v5.fake.build

Debugging of FAKE build scripts

We recommend Visual Studio Code with the Ionide extension for best FAKE tooling support, including proper debugging. The easiest way to debug a script is by using the "Debug" buttons in the FAKE targets outline

Non-Ionide or no Fake.Core.Targets

If you don't use Ionide or if you don't use Fake.Core.Targets the Outline stays empty and you (currently) cannot run or debug via UI. Please see the following sections on how to debug and run.

General considerations

Currently debugging via the chocolatey installation is not possible. This is because we currently do not distribute the x64 version on x64 versions of windows and the .NET Core debugger currently only supports x64!

Visual Studio Code && portable.zip

Debugging works (on windows) in the following way:

Visual Studio Code && dotnet fake

Add the following lines to your build script:

printfn "Press any key to continue..."
System.Console.ReadKey() |> ignore

Run script without fake.exe (via fsi)

FAKE 5 and above scripts are not hardwired to the new FAKE 5 runner (even if they look like with the new header). To make them work with FSI all you need to do is to setup a "FAKE-Context":

// Regular header and `#load ".fake/build.fsx/intellisense.fsx"`

#if !FAKE
let execContext = Fake.Core.Context.FakeExecutionContext.Create false "build.fsx" []
Fake.Core.Context.setExecutionContext (Fake.Core.Context.RuntimeContext.Fake execContext)
#endif

// Your Script code...

With these lines you can just run fsi build.fsx

You can use this "trick" to run the script via the regular IDE buttons.

To start a new context or cleanup the old one you can use (execute interactively):

execContext.Dispose()
let execContext = Fake.Core.Context.FakeExecutionContext.Create false "build.fsx" []
Fake.Core.Context.setExecutionContext (Fake.Core.Context.RuntimeContext.Fake execContext)