Skip to content

Commit

Permalink
Added new more comfortable and intuitive types to WiXHelper, flagged old
Browse files Browse the repository at this point in the history
ones obsolete and added example page
  • Loading branch information
Florian Kroenert authored and Florian Kroenert committed Dec 15, 2015
1 parent 25ca241 commit b68aa9a
Show file tree
Hide file tree
Showing 3 changed files with 600 additions and 35 deletions.
80 changes: 80 additions & 0 deletions help/wix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# Create WiX Setup

If you often ship software to customers, it might be comfortable for you to install it using setups rather than manually deploying.
FAKE provides you with support for creating MSI setups using the WiX Toolset (http://wixtoolset.org/).

## Minimal working example

Target "BuildWiXSetup" (fun _ ->
// This defines, which files should be collected when running bulkComponentCreation
let fileFilter = fun (file : FileInfo) ->
if file.Extension = ".dll" || file.Extension = ".exe" || file.Extension = ".config" then
true
else
false
// Collect Files which should be shipped. Pass directory with your deployment output for deployDir
let components = bulkComponentCreation fileFilter (DirectoryInfo deployDir)
// Collect component references for usage in features
let componentRefs = components |> Seq.map(fun comp -> comp.ToComponentRef())

let completeFeature = generateFeatureElement (fun f ->
{f with
Id = "Complete"
Title = "Complete Feature"
Level = 1
Description = "Installs all features"
Components = componentRefs
Display = Expand
})

// Generates a predefined WiX template with placeholders which will be replaced in "FillInWiXScript"
generateWiXScript "SetupTemplate.wxs"

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

let WiXUIError = generateUIRef (fun f ->
{f with
Id = "WixUI_ErrorProgressText"
})

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

FillInWiXTemplate "" (fun f ->
{f with
// Guid which should be generated on every build
ProductCode = Guid.NewGuid()
ProductName = "Test Setup"
Description = "Description of Test Setup"
ProductLanguage = 1033
ProductVersion = "1.0.0"
ProductPublisher = "YouOrYourCompany"
// Set fixed upgrade guid, this should never change for this project!
UpgradeGuid = WixProductUpgradeGuid
MajorUpgrade = [MajorUpgrade]
UIRefs = [WiXUIMondo; WiXUIError]
ProgramFilesFolder = ProgramFiles32
Components = components
BuildNumber = "Build number"
Features = [completeFeature]
})

// run the WiX tools
WiX (fun p -> {p with ToolDirectory = WiXPath})
setupFileName
@".\SetupTemplate.wxs"
)

## Further possibilities
Besides just plainly shipping those files as setup you can also use the custom action and custom action execution elements to execute various commands before or after certain events during the installation.
This gives you the possibility to for example install, uninstall, start or stop certain services when you need to.
Loading

0 comments on commit b68aa9a

Please sign in to comment.