FAKE - F# Make - A DSL for build tasks and more FAKE
6.0.0

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

v5.fake.build

Wix Module

Contains tasks to create msi installers using the WiX toolset

Types

Type Description

ActionExecutionVerb

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

Architecture

Set the platform architecture

Component

Component which wraps files into logical components

ComponentRef

Reference to a component for including it in a feature

CustomAction

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

CustomActionExecute

Used in CustomAction for determing when to run the custom action

CustomActionExecution

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

CustomActionReturn

Used in CustomAction for determining the return type

Dir

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

DirectoryComponent

Provide helpers Component and Dir types

DirectoryRef

Reference to a component for including it in a feature

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 determining whether the feature should be visible in the select features installer pane or not

File

WiX File Element

HeatParams

The Heat task parameters

InstallUninstall

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

MajorUpgrade

Parameters for WiX Major Upgrade

MajorUpgradeSchedule

Used for determining when to run RemoveExistingProducts on major upgrade

Params

WiX parameter type

ProgramFilesFolder

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

RegistryKey

Parameters for WiX RegistryKey

RegistryRootType

Represents the registry root under which this key should be written

RegistryValue

Parameters for WiX RegistryValue

RegistryValueAction

The action that will be taken for a registry value

RegistryValueType

The desired type of a registry key.

Script

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

ServiceConfig

Service configuration information for failure actions.

ServiceControl

Service Control Element. Can Start, Stop and Remove services

ServiceDependency

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

ServiceFailureActionType

Determines the type of the service failure action.

ServiceInstall

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

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.

UIRef

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

Upgrade

Parameters for WiX Upgrade

UpgradeVersion

Parameters for WiX Upgrade Version

Variable

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 value Description

Wix.Candle parameters wixScript

Full Usage: Wix.Candle parameters wixScript

Parameters:
    parameters : Params - Function used to override parameters for candle tool
    wixScript : string - The Wix setup script path

Returns: string

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

parameters : Params

Function used to override parameters for candle tool

wixScript : string

The Wix setup script path

Returns: string

Wix.HarvestDirectory setParams directory outputFile

Full Usage: Wix.HarvestDirectory setParams directory outputFile

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

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

setParams : HeatParams -> HeatParams

Function used to manipulate the Heat default parameters.

directory : string

The path to the directory that will be harvested by Heat.

outputFile : string

The output file path given to Heat.

Wix.Light parameters outputFile wixObj

Full Usage: Wix.Light parameters outputFile wixObj

Parameters:
    parameters : Params - Function used to override parameters for light tool
    outputFile : string - The output file path
    wixObj : string

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

parameters : Params

Function used to override parameters for light tool

outputFile : string

The output file path

wixObj : string

Wix.WiX setParams outputFile wixScript

Full Usage: Wix.WiX setParams outputFile wixScript

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

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

setParams : Params -> Params

Function used to manipulate the WiX default parameters.

outputFile : string

The msi output file path (given to Light).

wixScript : string

The path to a WiX script that will be used with Candle.

Example


 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@",getWixDirTag ALLFILES true (directoryInfo(bundledDir @@ "icons"))]

         processTemplates replacements setupFiles

         // run the WiX tools
         WiX (fun p -> {p with ToolDirectory = WiXPath})
             setupFileName
             (setupBuildDir + "Setup.wxs.template")
     )

Wix.attachServiceControlToComponent comp fileFilter serviceControls

Full Usage: Wix.attachServiceControlToComponent comp fileFilter serviceControls

Parameters:
Returns: DirectoryComponent

Use this to attach service controls to your components.

comp : DirectoryComponent

The directory component instance

fileFilter : Component -> bool

The file filter

serviceControls : seq<ServiceControl>

The service controls instance

Returns: DirectoryComponent

Wix.attachServiceControlToComponents components fileFilter serviceControls

Full Usage: Wix.attachServiceControlToComponents components fileFilter serviceControls

Parameters:
Returns: seq<DirectoryComponent>
components : seq<DirectoryComponent>
fileFilter : Component -> bool
serviceControls : seq<ServiceControl>
Returns: seq<DirectoryComponent>

Wix.attachServiceInstallToComponent comp fileFilter serviceInstalls

Full Usage: Wix.attachServiceInstallToComponent comp fileFilter serviceInstalls

Parameters:
Returns: DirectoryComponent

Use this to attach service installs to your components.

comp : DirectoryComponent

The directory component instance

fileFilter : Component -> bool

The file filter

serviceInstalls : seq<ServiceInstall>

The service installs instance to attach

Returns: DirectoryComponent

Wix.attachServiceInstallToComponents components fileFilter serviceInstalls

Full Usage: Wix.attachServiceInstallToComponents components fileFilter serviceInstalls

Parameters:
Returns: seq<DirectoryComponent>
components : seq<DirectoryComponent>
fileFilter : Component -> bool
serviceInstalls : seq<ServiceInstall>
Returns: seq<DirectoryComponent>

Wix.bulkComponentCreation fileFilter directoryInfo architecture

Full Usage: Wix.bulkComponentCreation fileFilter directoryInfo architecture

Parameters:
Returns: seq<DirectoryComponent>

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.

fileFilter : FileInfo -> bool

The files to filter

directoryInfo : DirectoryInfo
architecture : Architecture

The platform architecture

Returns: seq<DirectoryComponent>

Wix.bulkComponentCreationAsSubDir fileFilter directoryInfo architecture

Full Usage: Wix.bulkComponentCreationAsSubDir fileFilter directoryInfo architecture

Parameters:
    fileFilter : FileInfo -> bool - The files to filter
    directoryInfo : DirectoryInfo - The directory information
    architecture : Architecture - The platform architecture

Returns: Dir

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.

fileFilter : FileInfo -> bool

The files to filter

directoryInfo : DirectoryInfo

The directory information

architecture : Architecture

The platform architecture

Returns: Dir

Wix.bulkComponentTreeCreation fileFilter directoryFilter directoryInfo architecture

Full Usage: Wix.bulkComponentTreeCreation fileFilter directoryFilter directoryInfo architecture

Parameters:
    fileFilter : FileInfo -> bool - The files to filter
    directoryFilter : DirectoryInfo -> bool - The directories to filter
    directoryInfo : DirectoryInfo - The directory information
    architecture : Architecture - The platform architecture

Returns: seq<DirectoryComponent>

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

fileFilter : FileInfo -> bool

The files to filter

directoryFilter : DirectoryInfo -> bool

The directories to filter

directoryInfo : DirectoryInfo

The directory information

architecture : Architecture

The platform architecture

Returns: seq<DirectoryComponent>

Wix.fillInWiXTemplate wiXPath setParams

Full Usage: Wix.fillInWiXTemplate wiXPath setParams

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

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

wiXPath : string

Pass path where your script is located at. Function will search for all Scripts in that location and fill in parameters

setParams : Script -> Script

Function used to manipulate the WiX default parameters.

Example


 fillInWiXTemplate "" (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()
     })

Wix.generateComponentRef setParams

Full Usage: Wix.generateComponentRef setParams

Parameters:
Returns: ComponentRef option

Use this for generating component refs

setParams : ComponentRef -> ComponentRef

Function to override the default component ref parameters

Returns: ComponentRef option

Wix.generateCustomAction setParams

Full Usage: Wix.generateCustomAction setParams

Parameters:
Returns: CustomAction

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 getWixDirTag or getWixFileTag 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

setParams : CustomAction -> CustomAction

Function used to manipulate the WiX default parameters.

Returns: CustomAction
Example


 let action = generateCustomAction (fun f ->
         {f with
             Id = "UniqueActionId"
             FileKey = "fi_5"
             Execute = "deferred"
             Impersonate = "no"
             ExeCommand = "install"
             Return = "check"
         })

Wix.generateCustomActionExecution setParams

Full Usage: Wix.generateCustomActionExecution setParams

Parameters:
Returns: CustomActionExecution

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

setParams : CustomActionExecution -> CustomActionExecution

Function used to manipulate the WiX default parameters.

Returns: CustomActionExecution
Example


 let actionExecution = generateCustomActionExecution (fun f ->
         {f with
             ActionId = action.Id
             Verb = "After"
             Target = "InstallFiles"
             Condition = "(&" + feature.Id + " = 3) AND NOT (!" + feature.Id + " = 3)"
         })

Wix.generateFeatureElement setParams

Full Usage: Wix.generateFeatureElement setParams

Parameters:
    setParams : Feature -> Feature - Function used to manipulate the WiX default parameters.

Returns: 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

setParams : Feature -> Feature

Function used to manipulate the WiX default parameters.

Returns: Feature
Example


 let feature = generateFeatureElement (fun f ->
         {f with
             Id = "UniqueName"
             Title = "Title which is shown"
             Level = 1
             Description = "Somewhat longer description"
             Display = "expand"
             InnerContent = [otherFeature1; otherFeature2]
         })

Wix.generateMajorUpgradeVersion setParams

Full Usage: Wix.generateMajorUpgradeVersion setParams

Parameters:
Returns: MajorUpgrade

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

setParams : MajorUpgrade -> MajorUpgrade

Function used to manipulate the WiX default parameters.

Returns: MajorUpgrade
Example


 let majorUpgradeVersion = generateMajorUpgradeVersion(fun f ->
         {f with
             DowngradeErrorMessage = "A later version is already installed, exiting."
         })

Wix.generateRegistryKey setParams

Full Usage: Wix.generateRegistryKey setParams

Parameters:
Returns: RegistryKey

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

setParams : RegistryKey -> RegistryKey

Function used to manipulate the WiX default parameters.

Returns: RegistryKey
Example


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

Wix.generateRegistryValue setParams

Full Usage: Wix.generateRegistryValue setParams

Parameters:
Returns: RegistryValue

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

setParams : RegistryValue -> RegistryValue

Function used to manipulate the WiX default parameters.

Returns: RegistryValue
Example


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

Wix.generateServiceControl setParams

Full Usage: Wix.generateServiceControl setParams

Parameters:
Returns: ServiceControl

Use this for generating service controls

setParams : ServiceControl -> ServiceControl

Function to override the default service control parameters

Returns: ServiceControl

Wix.generateServiceInstall setParams

Full Usage: Wix.generateServiceInstall setParams

Parameters:
Returns: ServiceInstall

Use this for generating service installs

setParams : ServiceInstall -> ServiceInstall

Function to override the default service install parameters

Returns: ServiceInstall

Wix.generateUIRef setParams

Full Usage: Wix.generateUIRef setParams

Parameters:
    setParams : UIRef -> UIRef - Function used to manipulate the WiX default parameters.

Returns: UIRef

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

setParams : UIRef -> UIRef

Function used to manipulate the WiX default parameters.

Returns: UIRef
Example


 let UIRef = generateUIRef (fun f ->
         {f with
             Id = "WixUI_Mondo"
         })

Wix.generateUpgrade setParams

Full Usage: Wix.generateUpgrade setParams

Parameters:
    setParams : Upgrade -> Upgrade - Function used to manipulate the WiX default parameters.

Returns: Upgrade

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

setParams : Upgrade -> Upgrade

Function used to manipulate the WiX default parameters.

Returns: Upgrade
Example


 let upgrade = generateUpgrade (fun f ->
         {f with
            Id = productUpgradeCode
         })

Wix.generateUpgradeVersion setParams

Full Usage: Wix.generateUpgradeVersion setParams

Parameters:
Returns: UpgradeVersion

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

setParams : UpgradeVersion -> UpgradeVersion

Function used to manipulate the WiX default parameters.

Returns: UpgradeVersion
Example


 let upgradeVersion = generateUpgradeVersion (fun f ->
         {f with
            Minimum = productVersion
            OnlyDetect = "yes"
         })

Wix.generateWiXScript fileName

Full Usage: Wix.generateWiXScript fileName

Parameters:
    fileName : string - Pass desired fileName for your wiXScript file

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

fileName : string

Pass desired fileName for your wiXScript file

Example


 generateWiXScript "Setup.wxs"

Wix.getComponentIdsFromWiXString wiXString

Full Usage: Wix.getComponentIdsFromWiXString wiXString

Parameters:
    wiXString : string - The directory string which was generated by getWixDirTag

Returns: string

Retrieves all component ids from given WiX directory string

wiXString : string

The directory string which was generated by getWixDirTag

Returns: string
Example


 let directoryString = getWixDirTag (fun file -> true) true (DirectoryInfo directoryWithFilesForSetup)
 let componentIds = getComponentIdsFromWiXString directoryString

Wix.getComponentRefs elements

Full Usage: Wix.getComponentRefs elements

Parameters:
Returns: seq<ComponentRef option>

Get component refs from a directory component hierarchy

elements : seq<DirectoryComponent>

Sequence of directory component elements

Returns: seq<ComponentRef option>

Wix.getFileIdFromWiXString wiXString fileRegex

Full Usage: Wix.getFileIdFromWiXString wiXString fileRegex

Parameters:
    wiXString : string - The directory string which was generated by getWixDirTag
    fileRegex : string - Regex which matches the file name

Returns: string

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

wiXString : string

The directory string which was generated by getWixDirTag

fileRegex : string

Regex which matches the file name

Returns: string
Example


 let directoryString = getWixDirTag (fun file -> true) true (DirectoryInfo directoryWithFilesForSetup)
 let executableFileId = getFileIdFromWiXString directoryString "\S*.exe"

Wix.getFilesAsWiXString files

Full Usage: Wix.getFilesAsWiXString files

Parameters:
    files : seq<string> - The files to get

Returns: string

Creates WiX File tags from the given files

files : seq<string>

The files to get

Returns: string

Wix.getWixDirTag fileFilter asSubDir directoryInfo

Full Usage: Wix.getWixDirTag fileFilter asSubDir directoryInfo

Parameters:
    fileFilter : FileInfo -> bool - The file filter
    asSubDir : bool - The sub directory
    directoryInfo : DirectoryInfo - The directory information

Returns: 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.

fileFilter : FileInfo -> bool

The file filter

asSubDir : bool

The sub directory

directoryInfo : DirectoryInfo

The directory information

Returns: string

Wix.setComponentsNeverOverwrite components

Full Usage: Wix.setComponentsNeverOverwrite components

Parameters:
    components : string - The component string

Returns: string

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

components : string

The component string

Returns: string