Fsc

Contains tasks to compiles F# source file with the FSharp.Compiler.Service.

Note: This documentation is for FAKE version 5.0 or later. The old documentation can be found here

Nested types and modules

TypeDescription
Access

Used to set the Accessiblity of an embeded or linked resource

BuildException

An exception type to signal build errors.

CompilerFunc

Type signature for a Compiler Function

DebugType

Specify debugging type: full, pdbonly. ('full' is the default and enables attaching a debugger to a running program).

FscParam
FscResultMessage

Common Error Result type for tracing errors

Optimization

Optimization options that can be disabled or enabled selectively by listing them with the optimize compiler flag

PlatformType

Limit which platforms the compiled code can run on: x86, Itanium, x64, anycpu32bitpreferred, or anycpu. The default is anycpu.

Profile

Specify target framework profile of this assembly. Valid values are mscorlib or netcore. Default - mscorlib

ResourceInfo

Specified path of a managed resource with an optional name alias and accessiblity flag resinfo format is [,[,public|private]] e.g. resource.dat,rezName,public

TargetType

Functions and values

Function or valueDescription
Fsc.compile fscParams inputFiles
Signature: fscParams:FscParam list -> inputFiles:string list -> unit

Compiles one or more F# source files with the specified parameters.

Parameters

  • setParams - Function used to overwrite the default Fsc parameters.
  • inputFiles - The F# input files.

Sample

1: 
2: 
3: 
4: 
5: 
6: 
7: 
["file1.fs"; "file2.fs"]
|> compile [Out "" 
            Target Exe
            Platform AnyCpu
            References []
            Debug false 
        ]
Fsc.compileExternal(...)
Signature: fscTool:string -> fscParams:FscParam list -> inputFiles:string list -> unit

Compiles one or more F# source files with the specified parameters using an existing fsc.exe installed on the system

Parameters

  • fscTool - Path to an existing fsc.exe executable
  • setParams - Function used to overwrite the default Fsc parameters.
  • inputFiles - The F# input files.

Sample

1: 
2: 
3: 
4: 
5: 
6: 
7: 
8: 
["file1.fs"; "file2.fs"]
|> compileExternal "path/to/fsc.exe" 
            [Out "" 
            Target Exe
            Platform AnyCpu
            References []
            Debug false 
        ]
Fsc.compileExternalWithResult(...)
Signature: fscTool:string -> fscParams:FscParam list -> inputFiles:string list -> int

Compiles the given F# source files with the specified parameters.

Parameters

  • fscTool - Path to an existing fsc.exe executable
  • setParams - Function used to overwrite the default Fsc parameters.
  • inputFiles - The F# input files.

Returns

The exit status code of the compile process.

Sample

1: 
2: 
3: 
4: 
5: 
6: 
7: 
8: 
["file1.fs"; "file2.fs"]
|> compileExternalWithResult "path/to/fsc.exe" 
            [Out "" 
            Target Exe
            Platform AnyCpu
            References []
            Debug false 
        ]          
Fsc.compileFiles compiler srcFiles opts
Signature: compiler:CompilerFunc -> srcFiles:string list -> opts:string list -> int

Compiles the given source files with the given options using either the internal FCS or an external fsc.exe. If no options given (i.e. the second argument is an empty list), by default tries to behave the same way as would the command-line 'fsc.exe' tool.

Fsc.compileWithResult(...)
Signature: fscParams:FscParam list -> inputFiles:string list -> int

Compiles the given F# source files with the specified parameters.

Parameters

  • setParams - Function used to overwrite the default Fsc parameters.
  • inputFiles - The F# input files.

Returns

The exit status code of the compile process.

Sample

1: 
2: 
3: 
4: 
5: 
6: 
7: 
["file1.fs"; "file2.fs"]
|> compileWithResult [Out "" 
            Target Exe
            Platform AnyCpu
            References []
            Debug false 
        ]
Fsc.doCompile(...)
Signature: compiler:CompilerFunc -> fscParams:FscParam list -> inputFiles:string list -> int

Common compiler arg prep code

Fsc.extFscCompile fscTool optsArr
Signature: fscTool:string -> optsArr:string [] -> FscResultMessage [] * int

An external fsc.exe compiler

Fsc.makeArgsList opts srcFiles
Signature: opts:string list -> srcFiles:string list -> string []

Computes output type and appends source files to argument list

Fsc.reportErrors(errors)
Signature: errors:FscResultMessage [] -> unit

Reports Fsc compile errors to the console using Fake.Core.Trace

Fsc.resourceStr(arg1, arg2, arg3)
Signature: (string * string option * Access option) -> string
Fsc.scsCompile(optsArr)
Signature: optsArr:string [] -> FscResultMessage [] * int

The internal FCS Compiler