This documentation is for FAKE.exe before version 5 (or the non-netcore version). The documentation for FAKE 5 can be found here
The Fsc task set in FAKE can be used to build F# source files and output libraries, modules, and executables by using the bundled FSharp.Compiler.Service. In this tutorial we will look at these compile tasks.
Fsc task can be used in standard FAKE targets:
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18:
FscHelper.compile task takes two arguments:
- a list of compile parameters (
- a list of source files.
We start with the list of source files, and send it into the
FscHelper.compile task using F#'s
|> operator. The list of parameters included in the first argument will override the
In the above examples, notice that we don't always override the output
file name. By default
FscHelper.compile will behave exactly the same way as
fsc.exe. If you don't specify an output file: it will use the name of
the first input file, and the appropriate filename extension.
FscParam.Target also behaves in the same way as the
--target: switch: if you don't override it, it defaults to an
executable output type.
You can override all
fsc.exe default compile parameters by explicitly passing the values
you want to use. All F# compiler parameters are available as
FscParam union cases:
1: 2: 3: 4: 5: 6: 7: 8: 9: 10:
See the API docs for FscHelper for details of the available parameters.
FscHelper.compile task will print any compile warnings or errors. If there's any
compile error, it won't raise any error to interrupt the build process,
instead, it returns the exit status of the compile process.
Having an exit status code returned can be useful when you're trying to integrate FAKE with other build management tools, e.g. your own CI server or a test runner.
This task is lower level than the previous one. It takes a list of
source files and a list of strings which contains the same arguments
you'd pass in to the
fsc.exe command-line tool. It too prints warnings
and errors, and returns a compile exit status code. E.g.:
Target "Something.dll" (fun _ -> ["Something.fs"] |> FscHelper.compileFiles ["-o"; "Something.dll"; "--target:library"] |> ignore )
This task may be useful when you already have compile options in string
format and just need to pass them in to your build tool. You'd just need
to split the string on whitespace, and pass the resulting list into