This is part of the Fake.Installer.Wix module.

Wix

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 CustomActionExecution

Architecture
Component

Component which wraps files into logical components and which allows to

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 determing the return type

Dir

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

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

File

WiX File Element

HeatParams
InstallUninstall

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

MajorUpgrade

Parameters for WiX Major Upgrade

MajorUpgradeSchedule

Used for determing 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 valueDescription
Wix.attachServiceControlToComponent(...)
Signature: comp:DirectoryComponent -> fileFilter:(Component -> bool) -> serviceControls:seq<ServiceControl> -> DirectoryComponent
Wix.attachServiceControlToComponents(...)
Signature: components:seq<DirectoryComponent> -> fileFilter:(Component -> bool) -> serviceControls:seq<ServiceControl> -> seq<DirectoryComponent>
Wix.attachServiceInstallToComponent(...)
Signature: comp:DirectoryComponent -> fileFilter:(Component -> bool) -> serviceInstalls:seq<ServiceInstall> -> DirectoryComponent

Use this to attach service installs to your components.

Wix.attachServiceInstallToComponents(...)
Signature: components:seq<DirectoryComponent> -> fileFilter:(Component -> bool) -> serviceInstalls:seq<ServiceInstall> -> seq<DirectoryComponent>
Wix.bulkComponentCreation(...)
Signature: fileFilter:(FileInfo -> bool) -> directoryInfo:DirectoryInfo -> architecture:Architecture -> 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.

Wix.bulkComponentCreationAsSubDir(...)
Signature: fileFilter:(FileInfo -> bool) -> directoryInfo:DirectoryInfo -> architecture:Architecture -> 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.

Wix.bulkComponentTreeCreation(...)
Signature: fileFilter:(FileInfo -> bool) -> directoryFilter:(DirectoryInfo -> bool) -> directoryInfo:DirectoryInfo -> architecture:Architecture -> 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

Wix.Candle parameters wixScript
Signature: parameters:Params -> wixScript:string -> string

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

Wix.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: 
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)
Signature: setParams:(ComponentRef -> ComponentRef) -> ComponentRef option

Use this for generating component refs

Wix.generateCustomAction(setParams)
Signature: setParams:(CustomAction -> CustomAction) -> 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

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
Wix.generateCustomActionExecution(...)
Signature: setParams:(CustomActionExecution -> CustomActionExecution) -> 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

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
Wix.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 = generateFeatureElement (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
Wix.generateMajorUpgradeVersion(...)
Signature: setParams:(MajorUpgrade -> MajorUpgrade) -> MajorUpgrade

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
Wix.generateRegistryKey(setParams)
Signature: setParams:(RegistryKey -> RegistryKey) -> 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

Parameters

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

Sample

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)
Signature: setParams:(RegistryValue -> RegistryValue) -> RegistryValue

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 RegistryRootType.HKU Type = RegistryValueType.Integer KeyPath = YesOrNo.No Value = "2" })

Wix.generateServiceControl(setParams)
Signature: setParams:(ServiceControl -> ServiceControl) -> ServiceControl

Use this for generating service controls

Wix.generateServiceInstall(setParams)
Signature: setParams:(ServiceInstall -> ServiceInstall) -> ServiceInstall

Use this for generating service installs

Wix.generateUIRef(setParams)
Signature: setParams:(UIRef -> UIRef) -> UIRef

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
Wix.generateUpgrade(setParams)
Signature: setParams:(Upgrade -> Upgrade) -> Upgrade

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
Wix.generateUpgradeVersion(setParams)
Signature: setParams:(UpgradeVersion -> UpgradeVersion) -> UpgradeVersion

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
Wix.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"
Wix.getComponentIdsFromWiXString(...)
Signature: wiXString:string -> string

Retrieves all component ids from given WiX directory string

Parameters

  • wiXString - The directory string which was generated by getWixDirTag

Sample

1: 
2: 
let directoryString = getWixDirTag (fun file -> true) true (DirectoryInfo directoryWithFilesForSetup)
let componentIds = getComponentIdsFromWiXString directoryString
val directoryString : obj
val componentIds : obj
Wix.getComponentRefs(elements)
Signature: elements:seq<DirectoryComponent> -> seq<ComponentRef option>

get component refs from a directory component hierarchy

Wix.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 getWixDirTag
  • fileRegex - Regex which matches the file name

Sample

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

Creates WiX File tags from the given files

Wix.getWixDirTag(...)
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.

Wix.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.
Wix.Light parameters outputFile wixObj
Signature: parameters:Params -> outputFile:string -> wixObj:string -> unit

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

Wix.setComponentsNeverOverwrite(...)
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.WiX setParams outputFile wixScript
Signature: setParams:(Params -> Params) -> 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@",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")
)
val not : value:bool -> bool
namespace System
Multiple items
type Guid =
  struct
    new : b:byte[] -> Guid + 5 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
    member TryFormat : destination:Span<char> * charsWritten:int * ?format:ReadOnlySpan<char> -> bool
    member TryWriteBytes : destination:Span<byte> -> bool
    static val Empty : Guid
    static member NewGuid : unit -> Guid
    ...
  end

--------------------
System.Guid ()
System.Guid(b: byte []) : System.Guid
System.Guid(b: System.ReadOnlySpan<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