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

MSBuildHelper

Contains tasks which allow to use MSBuild (or xBuild on Linux/Unix) to build .NET project files or solution files.

Nested types and modules

TypeDescription
BuildException

An exception type to signal build errors.

MSBuildDistributedLoggerConfig
MSBuildFileLoggerConfig

A type for MSBuild configuration

MSBuildLogParameter

MSBuild log option

MSBuildParams

A type for MSBuild task parameters

MSBuildProject

A type to represent MSBuild project files.

MSBuildVerbosity

MSBuild verbosity option

MsBuildEntry

Functions and values

Function or valueDescription
build setParams project
Signature: setParams:(MSBuildParams -> MSBuildParams) -> project:string -> unit

Runs a MSBuild project

Parameters

  • setParams - A function that overwrites the default MsBuildParams
  • project - A string with the path to the project file to build.

Sample

 1: 
 2: 
 3: 
 4: 
 5: 
 6: 
 7: 
 8: 
 9: 
10: 
11: 
12: 
13: 
14: 
let buildMode = getBuildParamOrDefault "buildMode" "Release"
let setParams defaults =
        { defaults with
            Verbosity = Some(Quiet)
            Targets = ["Build"]
            Properties =
                [
                    "Optimize", "True"
                    "DebugSymbols", "True"
                    "Configuration", buildMode
                ]
         }
build setParams "./MySolution.sln"
      |> DoNothing
val buildMode : obj
val setParams : defaults:'a -> 'a
val defaults : 'a
union case Option.Some: Value: 'T -> Option<'T>
BuildWebsite outputPath projectFile
Signature: outputPath:string -> projectFile:string -> unit

Builds the given web project file with debug configuration and copies it to the given outputPath.

Parameters

  • outputPath - The output path.
  • projectFile - The project file path.
BuildWebsiteConfig(...)
Signature: outputPath:string -> configuration:string -> projectFile:string -> unit

Builds the given web project file in the specified configuration and copies it to the given outputPath.

Parameters

  • outputPath - The output path.
  • configuration - MSBuild configuration.
  • projectFile - The project file path.
BuildWebsites outputPath projectFiles
Signature: outputPath:string -> projectFiles:seq<string> -> unit

Builds the given web project files with debug configuration and copies them to the given websiteDir.

Parameters

  • outputPath - The output path.
  • projectFiles - The project file paths.
BuildWebsitesConfig(...)
Signature: outputPath:string -> configuration:string -> projectFiles:seq<string> -> unit

Builds the given web project files in specified configuration and copies them to the given outputPath.

Parameters

  • outputPath - The output path.
  • configuration - MSBuild configuration.
  • projectFiles - The project file paths.
getAllKnownPaths
Signature: string list
knownMsBuildEntries
Signature: MsBuildEntry list
monoVersionToUseMSBuildOn
Signature: Version

Versions of Mono prior to this one have faulty implementations of MSBuild NOTE: in System.Version 5.0 >= 5.0.0.0 is false while 5.0.0.0 >= 5.0 is true...

MSBuild(...)
Signature: outputPath:string -> targets:string -> properties:(string * string) list -> projects:seq<string> -> string list

Builds the given project files or solution files and collects the output files.

Parameters

  • outputPath - If it is null or empty then the project settings are used.
  • targets - A string with the target names which should be run by MSBuild.
  • properties - A list with tuples of property name and property values.
  • projects - A list of project or solution files.
MSBuildDebug outputPath targets projects
Signature: outputPath:string -> targets:string -> projects:seq<string> -> string list

Builds the given project files or solution files and collects the output files.

Parameters

  • outputPath - If it is null or empty then the project settings are used.
  • targets - A string with the target names which should be run by MSBuild.
  • projects - A list of project or solution files.
MSBuildDefaults
Signature: MSBuildParams

Defines a default for MSBuild task parameters

msBuildExe
Signature: string

Tries to detect the right version of MSBuild. - On all OS's, we check a MSBuild environment variable which is either a direct path to a file to use, or a directory that contains a file called msbuild on non-Windows systems with mono >= 5.0.0.0, or xbuild on non-Windows systems with mono < 5.0.0.0, * `MSBuild.exe` on Windows systems, or * a tool that exists on the current PATH - In addition, on non-Windows systems we check the current PATH for the following binaries, in this order: * Mono >= 5.0.0.0: msbuild, xbuild Mono < 5.0.0.0: xbuild, msbuild This is due to several known issues in the Mono < 5.0 implementation of MSBuild. - In addition, on Windows systems we try to read the MSBuild tool location from the AppSettings file using a parameter named MSBuild, and finally if a VisualStudioVersion environment variable is specified, we try to use the specific MSBuild version, matching that Visual Studio version.

MSBuildLoggers
Signature: string list

Defines the loggers to use for MSBuild task

MSBuildRelease(...)
Signature: outputPath:string -> targets:string -> projects:seq<string> -> string list

Builds the given project files or solution files and collects the output files.

Parameters

  • outputPath - If it is null or empty then the project settings are used.
  • targets - A string with the target names which should be run by MSBuild.
  • projects - A list of project or solution files.
MSBuildReleaseExt(...)
Signature: outputPath:string -> properties:(string * string) list -> targets:string -> projects:seq<string> -> string list

Builds the given project files or solution files in release mode and collects the output files.

Parameters

  • outputPath - If it is null or empty then the project settings are used.
  • properties - A list with tuples of property name and property values.
  • targets - A string with the target names which should be run by MSBuild.
  • projects - A list of project or solution files.
MSBuildWithDefaults targets projects
Signature: targets:string -> projects:seq<string> -> string list

Builds the given project files or solution files in release mode to the default outputs.

Parameters

  • targets - A string with the target names which should be run by MSBuild.
  • projects - A list of project or solution files.
MSBuildWithProjectProperties(...)
Signature: outputPath:string -> targets:string -> properties:(string -> (string * string) list) -> projects:seq<string> -> string list

Builds the given project files and collects the output files.

Parameters

  • outputPath - If it is null or empty then the project settings are used.
  • targets - A string with the target names which should be run by MSBuild.
  • properties - A list with tuples of property name and property values.
  • projects - A list of project or solution files.
oldMsBuildLocations
Signature: string list
toDict(items)
Signature: items:seq<MsBuildEntry> -> Map<string,string list>