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

WiXHelper

Contains tasks to create msi installers using the WiX toolset

Nested types and modules

TypeDescription
ActionExecutionVerb

Used for specifying the point of time for action execution in WiXCustomActionExecution

Architecture
CustomActionExecute

Used in WiXCustomAction for determing when to run the custom action

CustomActionReturn

Used in WiXCustomAction for determing the return type

ErrorControl

Determines what action should be taken on an error.

Feature

Parameters for creating WiX Feature, use ToString for creating the string xml nodes

FeatureDisplay

Used for determing whether the feature should be visible in the select features installer pane or not

HeatParams
InstallUninstall

Specifies whether an action occur on install, uninstall or both.

MajorUpgradeSchedule

Used for determing when to run RemoveExistingProducts on major upgrade

ProgramFilesFolder

Type for defining, which program directory should be used for installation. ProgramFiles32 refers to 'Program Files (x86)', ProgramFiles64 refers to 'Program Files'

Script

Parameters for WiX Script properties, use ToString for creating the string xml nodes

ServiceFailureActionType

Determines the type of the service failure action.

ServiceInstallStart

Determines when the service should be started. The Windows Installer does not support boot or system.

ServiceInstallType

Determines the type of the service. The Windows Installer does not currently support kernelDriver or systemDriver.

WiXComponent

Component which wraps files into logical components and which allows to

WiXComponentRef

Reference to a component for including it in a feature

WiXCustomAction

Parameters for WiX custom action, use ToString for creating the string xml nodes

WiXCustomActionExecution

Parameters for WiX Custom Action executions (In InstallExecuteSequence), use ToString for creating the string xml nodes

WiXDir

WiX Directories define a logical directory which can include components and files

WiXDirectoryComponent
WiXDirectoryRef

Reference to a component for including it in a feature

WiXFeature
OBSOLETE

Please use the new Feature type which features automatic string concatenation of inner features

Parameters for creating WiX Feature, use ToString for creating the string xml nodes

WiXFile

WiX File Element

WiXMajorUpgrade

Parameters for WiX Major Upgrade

WiXParams

WiX parameter type

WiXRegistryKey

Parameters for WiX RegistryKey

WiXRegistryRootType

Represents the registry root under which this key should be written

WiXRegistryValue

Parameters for WiX RegistryValue

WiXRegistryValueAction

The action that will be taken for a registry value

WiXRegistryValueType

The desired type of a registry key.

WiXScript
OBSOLETE

Please use new 'Script' type

Parameters for WiX Script properties, use ToString for creating the string xml nodes

WiXServiceConfig

Service configuration information for failure actions.

WiXServiceControl

Service Control Element. Can Start, Stop and Remove services

WiXServiceDependency

Service or group of services that must start before the parent service.

WiXServiceInstall

Adds services for parent Component. Use the ServiceControl element to remove services.

WiXUIRef

Parameters for WiX UI Reference, use ToString for creating the string xml nodes

WiXUpgrade

Parameters for WiX Upgrade

WiXUpgradeVersion

Parameters for WiX Upgrade Version

WiXVariable

Parameters for WiX Variable, use ToString for creating the string xml nodes

YesOrNo

These are used in many methods for generating WiX nodes, regard them as booleans

Functions and values

Function or valueDescription
attachServiceControlToComponent(...)
Signature: comp:WiXDirectoryComponent -> fileFilter:(WiXComponent -> bool) -> serviceControls:seq<WiXServiceControl> -> WiXDirectoryComponent
attachServiceControlToComponents(...)
Signature: components:seq<WiXDirectoryComponent> -> fileFilter:(WiXComponent -> bool) -> serviceControls:seq<WiXServiceControl> -> seq<WiXDirectoryComponent>
attachServiceInstallToComponent(...)
Signature: comp:WiXDirectoryComponent -> fileFilter:(WiXComponent -> bool) -> serviceInstalls:seq<WiXServiceInstall> -> WiXDirectoryComponent

Use this to attach service installs to your components.

attachServiceInstallToComponents(...)
Signature: components:seq<WiXDirectoryComponent> -> fileFilter:(WiXComponent -> bool) -> serviceInstalls:seq<WiXServiceInstall> -> seq<WiXDirectoryComponent>
bulkComponentCreation(...)
Signature: fileFilter:(FileInfo -> bool) -> directoryInfo:DirectoryInfo -> architecture:Architecture -> seq<WiXDirectoryComponent>

Creates WiX component with directories and files from the given DirectoryInfo The function will create one component for each file best practice and set the GUID to "*", which will make WiX produce consistent Component Guids if the Component's target path doesn't change. This is vital for major upgrades, since windows installer needs a consistent component guid for tracking each of them. You can use the getComponentIdsFromWiXString function for getting all created component refs and adding them to features.

bulkComponentCreationAsSubDir(...)
Signature: fileFilter:(FileInfo -> bool) -> directoryInfo:DirectoryInfo -> architecture:Architecture -> WiXDir

Creates WiX component with directories and files from the given DirectoryInfo The function will create one component for each file best practice and set the GUID to "*", which will make WiX produce consistent Component Guids if the Component's target path doesn't change. This is vital for major upgrades, since windows installer needs a consistent component guid for tracking each of them. The components are embedded into the passed in root directory.

bulkComponentTreeCreation(...)
Signature: fileFilter:(FileInfo -> bool) -> directoryFilter:(DirectoryInfo -> bool) -> directoryInfo:DirectoryInfo -> architecture:Architecture -> seq<WiXDirectoryComponent>

Creates a WiX directory and component hierarchy from the given DirectoryInfo The function will create one component for each file best practice and set the GUID to "*", which will make WiX produce consistent Component Guids if the Component's target path doesn't change. This is vital for major upgrades, since windows installer needs a consistent component guid for tracking each of them. You can use the getComponentRefs function for getting all created component refs and adding them to features. You can use attachServiceControlToComponents or attachServiceInstallToComponents to attach ServiceControl or ServiceInstall to the directory component hierarchy

Candle parameters wixScript
Signature: parameters:WiXParams -> wixScript:string -> string

Runs the Candle tool on the given WiX script with the given parameters

compName(comp)
Signature: comp:string -> string
compRefName(compRef)
Signature: compRef:string -> string
dirName(dir)
Signature: dir:string -> string
FeatureDefaults
Signature: Feature

Default values for creating WiX Feature

FillInWixScript wiXPath setParams
Signature: wiXPath:string -> setParams:(WiXScript -> WiXScript) -> unit
Attributes:
[<Obsolete("Please use new FillInWiXTemplate function")>]
OBSOLETE

Please use new FillInWiXTemplate function

Takes path where script files reside and sets all parameters as defined

Parameters

  • wiXPath - Pass path where your script is located at. Function will search for all Scripts in that location and fill in parameters
  • setParams - Function used to manipulate the WiX default parameters.

Sample

 1: 
 2: 
 3: 
 4: 
 5: 
 6: 
 7: 
 8: 
 9: 
10: 
11: 
12: 
13: 
14: 
15: 
16: 
17: 
FillInWixScript "" (fun f ->
                       {f with
                           ProductCode = WiXProductCode
                           ProductName = WiXProductName
                           Description = projectDescription
                           ProductLanguage = WiXProductLanguage
                           ProductVersion = WiXProductVersion
                           ProductPublisher = WixProductPublisher
                           UpgradeGuid = WixProductUpgradeGuid
                           UIRefs = uiRef1.ToString() + uiRef2.ToString()
                           WiXVariables = wiXLicense.ToString()
                           Directories = directories
                           BuildNumber = "1.0.0"
                           Features = rootFeature.ToString()
                           CustomActions = action1.ToString() + action2.ToString()
                           ActionSequences = actionExecution1.ToString() + actionExecution2.ToString()
                       })
FillInWiXTemplate wiXPath setParams
Signature: wiXPath:string -> setParams:(Script -> Script) -> unit

Takes path where script files reside and sets all parameters as defined

Parameters

  • wiXPath - Pass path where your script is located at. Function will search for all Scripts in that location and fill in parameters
  • setParams - Function used to manipulate the WiX default parameters.

Sample

 1: 
 2: 
 3: 
 4: 
 5: 
 6: 
 7: 
 8: 
 9: 
10: 
11: 
12: 
13: 
14: 
15: 
16: 
17: 
18: 
FillInWixScript "" (fun f ->
                       {f with
                           ProductCode = WiXProductCode
                           ProductName = WiXProductName
                           Description = projectDescription
                           ProductLanguage = WiXProductLanguage
                           ProductVersion = WiXProductVersion
                           ProductPublisher = WixProductPublisher
                           UpgradeGuid = WixProductUpgradeGuid
                           UIRefs = uiRef1.ToString() + uiRef2.ToString()
                           WiXVariables = wiXLicense.ToString()
                           Directories = directories
                           DirectoryRefs = directoryrefs
                           BuildNumber = "1.0.0"
                           Features = rootFeature.ToString()
                           CustomActions = action1.ToString() + action2.ToString()
                           ActionSequences = actionExecution1.ToString() + actionExecution2.ToString()
                       })
generateComponent(setParams)
Signature: setParams:(WiXComponent -> WiXComponent) -> WiXComponent

Use this for generating single components

generateComponentRef(setParams)
Signature: setParams:(WiXComponentRef -> WiXComponentRef) -> WiXComponentRef option

Use this for generating component refs

generateCustomAction(setParams)
Signature: setParams:(WiXCustomAction -> WiXCustomAction) -> WiXCustomAction

Generates a customAction based on the given parameters, use toString on it when embedding it Be careful to make Id unique. FileKey is a reference to a file Id which you added by using wixDir or wixFile Set impersonate to no if your action needs elevated privileges, you should then also set execute as "deferred" ExeCommand are the parameters passed to your executable

Parameters

  • setParams - Function used to manipulate the WiX default parameters.

Sample

1: 
2: 
3: 
4: 
5: 
6: 
7: 
8: 
9: 
let action = generateCustomAction (fun f ->
                                       {f with
                                           Id = "UniqueActionId"
                                           FileKey = "fi_5"
                                           Execute = "deferred"
                                           Impersonate = "no"
                                           ExeCommand = "install"
                                           Return = "check"
                                       })
val action : obj
generateCustomActionExecution(setParams)
Signature: setParams:(WiXCustomActionExecution -> WiXCustomActionExecution) -> WiXCustomActionExecution

Generates a custom action execution based on the given parameters, use toString on it when embedding it Condition in sample makes execute only on install

Parameters

  • setParams - Function used to manipulate the WiX default parameters.

Sample

1: 
2: 
3: 
4: 
5: 
6: 
7: 
let actionExecution = generateCustomActionExecution (fun f ->
                                                           {f with 
                                                               ActionId = action.Id
                                                               Verb = "After"
                                                               Target = "InstallFiles"                                                                        
                                                               Condition = "<![CDATA[(&" + feature.Id + " = 3) AND NOT (!" + feature.Id + " = 3)]]>"
                                                           })
val actionExecution : obj
generateDirectory(setParams)
Signature: setParams:(WiXDir -> WiXDir) -> WiXDir

Use this for generating directories

generateDirectoryRef(setParams)
Signature: setParams:(WiXDirectoryRef -> WiXDirectoryRef) -> WiXDirectoryRef

Use this for generating component refs

generateFeature(setParams)
Signature: setParams:(WiXFeature -> WiXFeature) -> WiXFeature
Attributes:
[<Obsolete("Please use the new ")>]
OBSOLETE

Please use the new

Generates a feature based on the given parameters, use toString on it when embedding it You can pass other features into InnerContent for making a hierarchy

Parameters

  • setParams - Function used to manipulate the WiX default parameters.

Sample

1: 
2: 
3: 
4: 
5: 
6: 
7: 
8: 
9: 
let feature = generateFeature (fun f -> 
                                   {f with  
                                       Id = "UniqueName"
                                       Title = "Title which is shown"
                                       Level = 1 
                                       Description = "Somewhat longer description" 
                                       Display = "expand" 
                                       InnerContent = otherFeature.ToString()
                                   })
val feature : obj
generateFeatureElement(setParams)
Signature: setParams:(Feature -> Feature) -> Feature

Generates a feature based on the given parameters, use toString on it when embedding it You can pass other features into InnerContent for making a hierarchy

Parameters

  • setParams - Function used to manipulate the WiX default parameters.

Sample

1: 
2: 
3: 
4: 
5: 
6: 
7: 
8: 
9: 
let feature = generateFeature (fun f -> 
                                   {f with  
                                       Id = "UniqueName"
                                       Title = "Title which is shown"
                                       Level = 1 
                                       Description = "Somewhat longer description" 
                                       Display = "expand" 
                                       InnerContent = [otherFeature1; otherFeature2]
                                   })
val feature : obj
generateMajorUpgradeVersion(setParams)
Signature: setParams:(WiXMajorUpgrade -> WiXMajorUpgrade) -> WiXMajorUpgrade

Generates a major upgrade based on the given parameters, use toString on it when embedding it

Parameters

  • setParams - Function used to manipulate the WiX default parameters.

Sample

1: 
2: 
3: 
4: 
let majorUpgradeVersion = generateMajorUpgradeVersion(fun f ->
                                                {f with 
                                                    DowngradeErrorMessage = "A later version is already installed, exiting."
                                                })
val majorUpgradeVersion : obj
generateRegistryKey(setParams)
Signature: setParams:(WiXRegistryKey -> WiXRegistryKey) -> WiXRegistryKey

Generates a registry key based on the given parameters, use toString on it when embedding it You can pass other registry keys and values into RegistryKeys or RegistryValues for making a hierarchy

Parameters

  • setParams - Function used to manipulate the WiX default parameters.

Sample

let key = generateRegistryKey(fun k -> {k with Id = "KeyId" Key = "SomeKey" Root = Some WiXRegistryRootType.HKCR ForceCreateOnInstall = YesOrNo.Yes ForceDeleteOnUninstall = YesOrNo.No Keys = someChildKeys Values = someChildValues })

generateRegistryValue(setParams)
Signature: setParams:(WiXRegistryValue -> WiXRegistryValue) -> WiXRegistryValue

Generates a registry value based on the given parameters, use toString on it when embedding it

Parameters

  • setParams - Function used to manipulate the WiX default parameters.

Sample

let registryValue = generateRegistryValue(fun v -> {v with Id = "asdasd" Name = "Something" Key = "Somewhere" Root = Some WiXRegistryRootType.HKU Type = WiXRegistryValueType.Integer KeyPath = YesOrNo.No Value = "2" })

generateServiceConfig(setParams)
Signature: setParams:(WiXServiceConfig -> WiXServiceConfig) -> WiXServiceConfig

Use this for generating service configs

generateServiceControl(setParams)
Signature: setParams:(WiXServiceControl -> WiXServiceControl) -> WiXServiceControl

Use this for generating service controls

generateServiceDependency(setParams)
Signature: setParams:(WiXServiceDependency -> WiXServiceDependency) -> WiXServiceDependency

Use this for generating service dependencies

generateServiceInstall(setParams)
Signature: setParams:(WiXServiceInstall -> WiXServiceInstall) -> WiXServiceInstall

Use this for generating service installs

generateUIRef(setParams)
Signature: setParams:(WiXUIRef -> WiXUIRef) -> WiXUIRef

Generates a ui ref based on the given parameters, use toString on it when embedding it

Parameters

  • setParams - Function used to manipulate the WiX default parameters.

Sample

1: 
2: 
3: 
4: 
let UIRef = generateUIRef (fun f ->
                               {f with
                                   Id = "WixUI_Mondo"
                               })
val UIRef : obj
generateUpgrade(setParams)
Signature: setParams:(WiXUpgrade -> WiXUpgrade) -> WiXUpgrade

Generates an upgrade based on the given parameters, use toString on it when embedding it

Parameters

  • setParams - Function used to manipulate the WiX default parameters.

Sample

1: 
2: 
3: 
4: 
let upgrade = generateUpgrade (fun f ->
                                  {f with
                                     Id = productUpgradeCode
                                  })
val upgrade : obj
generateUpgradeVersion(setParams)
Signature: setParams:(WiXUpgradeVersion -> WiXUpgradeVersion) -> WiXUpgradeVersion

Generates an upgrade version based on the given parameters, use toString on it when embedding it

Parameters

  • setParams - Function used to manipulate the WiX default parameters.

Sample

1: 
2: 
3: 
4: 
5: 
let upgradeVersion = generateUpgradeVersion (fun f ->
                                                {f with
                                                   Minimum = productVersion
                                                   OnlyDetect = "yes"
                                                })
val upgradeVersion : obj
generateWiXScript(fileName)
Signature: fileName:string -> unit

Generates WiX Template with specified file name (you can prepend location too) You need to run this once every build an then use FillInWiXScript to replace placeholders

Parameters

  • fileName - Pass desired fileName for your wiXScript file

Sample

1: 
generateWiXScript "Setup.wxs"
getComponentIdsFromWiXString(wiXString)
Signature: wiXString:string -> string

Retrieves all component ids from given WiX directory string

Parameters

  • wiXString - The directory string which was generated by wixDir

Sample

1: 
2: 
let directoryString = wixDir (fun file -> true) true (DirectoryInfo directoryWithFilesForSetup)
let componentIds = getComponentIdsFromWiXString directoryString
val directoryString : obj
val componentIds : obj
getComponentRefs(elements)
Signature: elements:seq<WiXDirectoryComponent> -> seq<WiXComponentRef option>

get component refs from a directory component hierarchy

getFileIdFromWiXString(...)
Signature: wiXString:string -> fileRegex:string -> string

Retrieves the file id of the first file in WiXString, which name matches fileRegex

Parameters

  • wiXString - The directory string which was generated by wixDir
  • fileRegex - Regex which matches the file name

Sample

1: 
2: 
let directoryString = wixDir (fun file -> true) true (DirectoryInfo directoryWithFilesForSetup)
let executableFileId = getFileIdFromWiXString directoryString "\S*.exe"
val directoryString : obj
val executableFileId : obj
getFilesAsWiXString(files)
Signature: files:seq<string> -> string

Creates WiX File tags from the given files

HarvestDirectory(...)
Signature: setParams:(HeatParams -> HeatParams) -> directory:string -> outputFile:string -> unit

Harvests the contents of a Directory for use with Wix using the Heat tool.

Parameters

  • setParams - Function used to manipulate the Heat default parameters.
  • directory - The path to the directory that will be harvested by Heat.
  • outputFile - The output file path given to Heat.
HeatDefaulParams
Signature: HeatParams

Default values for the Heat harvesting

Light parameters outputFile wixObj
Signature: parameters:WiXParams -> outputFile:string -> wixObj:string -> unit

Runs the Light tool on the given WiX script with the given parameters

ScriptDefaults
Signature: Script

Default values for WiX Script properties

setComponentsNeverOverwrite(components)
Signature: components:string -> string

Take a component string and set "neverOverwrite" Tag This is useful for config files, since they are not replaced on upgrade like that

WiX setParams outputFile wixScript
Signature: setParams:(WiXParams -> WiXParams) -> outputFile:string -> wixScript:string -> unit

Uses the WiX tools Candle and Light to create an msi.

Parameters

  • setParams - Function used to manipulate the WiX default parameters.
  • outputFile - The msi output file path (given to Light).
  • wixScript - The path to a WiX script that will be used with Candle.

Sample

 1: 
 2: 
 3: 
 4: 
 5: 
 6: 
 7: 
 8: 
 9: 
10: 
11: 
12: 
13: 
14: 
15: 
16: 
17: 
18: 
19: 
20: 
21: 
22: 
23: 
24: 
Target "BuildSetup" (fun _ ->
    // Copy all important files to the deploy directory
    !! (buildDir + "/**/*.dll")
      ++ (buildDir + "/**/*.exe")
      ++ (buildDir + "/**/*.config")
      |> Copy deployPrepDir 

    // replace tags in a template file in order to generate a WiX script
    let ALLFILES = fun _ -> true

    let replacements = [
        "@build.number@",if not isLocalBuild then buildVersion else "0.1.0.0"
        "@product.productcode@",System.Guid.NewGuid().ToString()
        "@HelpFiles@",getFilesAsWiXString helpFiles
        "@ScriptFiles@",getFilesAsWiXString scriptFiles
        "@icons@",wixDir ALLFILES true (directoryInfo(bundledDir @@ "icons"))]

    processTemplates replacements setupFiles

    // run the WiX tools
    WiX (fun p -> {p with ToolDirectory = WiXPath}) 
        setupFileName
        (setupBuildDir + "Setup.wxs.template")
)
val not : value:bool -> bool
namespace System
Multiple items
type Guid =
  struct
    new : b:byte[] -> Guid + 4 overloads
    member CompareTo : value:obj -> int + 1 overload
    member Equals : o:obj -> bool + 1 overload
    member GetHashCode : unit -> int
    member ToByteArray : unit -> byte[]
    member ToString : unit -> string + 2 overloads
    static val Empty : Guid
    static member NewGuid : unit -> Guid
    static member Parse : input:string -> Guid
    static member ParseExact : input:string * format:string -> Guid
    ...
  end

--------------------
System.Guid ()
System.Guid(b: byte []) : System.Guid
System.Guid(g: string) : System.Guid
System.Guid(a: int, b: int16, c: int16, d: byte []) : System.Guid
System.Guid(a: uint32, b: uint16, c: uint16, d: byte, e: byte, f: byte, g: byte, h: byte, i: byte, j: byte, k: byte) : System.Guid
System.Guid(a: int, b: int16, c: int16, d: byte, e: byte, f: byte, g: byte, h: byte, i: byte, j: byte, k: byte) : System.Guid
System.Guid.NewGuid() : System.Guid
WiXComponentDefaults
Signature: WiXComponent

Defaults for component

WiXComponentRefDefaults
Signature: WiXComponentRef

Defaults for component ref

wixComponentRefs(directoryInfo)
Signature: directoryInfo:DirectoryInfo -> string

Creates WiX ComponentRef tags from the given DirectoryInfo

WiXCustomActionDefaults
Signature: WiXCustomAction

Default values for WiX custom actions

WixCustomActionExecutionDefaults
Signature: WiXCustomActionExecution

Default values for WiX custom action executions

WiXDefaults
Signature: WiXParams

Contains the WiX default parameters

wixDir fileFilter asSubDir directoryInfo
Signature: fileFilter:(FileInfo -> bool) -> asSubDir:bool -> directoryInfo:DirectoryInfo -> string

Creates recursive WiX directory and file tags from the given DirectoryInfo The function will create one component for each file best practice and set the GUID to "*", which will make WiX produce consistent Component Guids if the Component's target path doesn't change. This is vital for major upgrades, since windows installer needs a consistent component guid for tracking each of them. You can use the getComponentIdsFromWiXString function for getting all created component refs and adding them to features.

WiXDirDefaults
Signature: WiXDir

Defaults for directories

WiXDirectoryRefDefaults
Signature: WiXDirectoryRef

Defaults for component ref

WiXFeatureDefaults
Signature: WiXFeature
Attributes:
[<Obsolete("Please use the new Feature type which features automatic string concatenation of inner features")>]
OBSOLETE

Please use the new Feature type which features automatic string concatenation of inner features

Default values for creating WiX Feature

wixFile(fileInfo)
Signature: fileInfo:FileInfo -> string

Creates a WiX File tag from the given FileInfo

WiXFileDefaults
Signature: WiXFile

Defaults for WiX file

WiXMajorUpgradeDefaults
Signature: WiXMajorUpgrade

Default value for WiX Major Upgrade

wixRegistryKeyDefaults
Signature: WiXRegistryKey
wixRegistryValueDefaults
Signature: WiXRegistryValue
WiXScriptDefaults
Signature: WiXScript
Attributes:
[<Obsolete("Please use new 'Script' type")>]
OBSOLETE

Please use new 'Script' type

Default values for WiX Script properties

WiXServiceConfigDefaults
Signature: WiXServiceConfig
WiXServiceControlDefaults
Signature: WiXServiceControl

Defaults for service control element

WiXServiceDependencyDefaults
Signature: WiXServiceDependency
WiXServiceInstallDefaults
Signature: WiXServiceInstall

Defaults for service install element

WiXUIRefDefaults
Signature: WiXUIRef

Default value for WiX UI Reference (WixUI_Minimal)

WiXUpgradeDefaults
Signature: WiXUpgrade

Default value for WiX Upgrade

WiXUpgradeVersionDefaults
Signature: WiXUpgradeVersion

Default value for WiX Upgrade

WiXVariableDefaults
Signature: WiXVariable

Default value for WiX Variable