From 44799ae9f285023cddd32bd15421b08c18b269bb Mon Sep 17 00:00:00 2001 From: Florian Kroenert Date: Tue, 26 May 2015 15:53:06 +0200 Subject: [PATCH] Refactored wixDir function to fit best practices and improve major upgrade support --- src/app/FakeLib/WiXHelper.fs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/app/FakeLib/WiXHelper.fs b/src/app/FakeLib/WiXHelper.fs index f41f2bd013f..7533e58a0ea 100644 --- a/src/app/FakeLib/WiXHelper.fs +++ b/src/app/FakeLib/WiXHelper.fs @@ -53,6 +53,10 @@ let getFilesAsWiXString files = |> toLines /// Creates recursive WiX directory and file tags from the given DirectoryInfo +/// The function will create one component for each file [best practice](https://support.microsoft.com/de-de/kb/290997/en-us) +/// 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. let rec wixDir fileFilter asSubDir (directoryInfo : DirectoryInfo) = let dirs = directoryInfo @@ -70,8 +74,9 @@ let rec wixDir fileFilter asSubDir (directoryInfo : DirectoryInfo) = let compo = if files = "" then "" else - sprintf "\r\n%s\r\n\r\n" (compName directoryInfo.Name) - (Guid.NewGuid().ToString()) files + split '\n' files + |> Seq.map(fun f -> sprintf "\r\n%s\r\n\r\n" (compName directoryInfo.Name) "*" f) + |> toLines if asSubDir then sprintf "\r\n%s%s\r\n\r\n" (dirName directoryInfo.Name)