-
Notifications
You must be signed in to change notification settings - Fork 587
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WiXHelper: Refactor wixDir function to improve major upgrade support #818
WiXHelper: Refactor wixDir function to improve major upgrade support #818
Conversation
WiXHelper: Refactor wixDir function to improve major upgrade support
WiXHelper: Refactor wixDir function to improve major upgrade support
I had to revert this since I'm getting:
... Any chance you could resend the PR with a fixed version? |
I would like to look into this, which functions did you use, which file selector? |
there is nothing special in it. |
Ok, so the icons and diffmerge part of the replacements rolls up to a feature in your template then? |
|
I'll have to look deeper into this, I'm guessing that there might be line breaks in the file tags, which leads to errors when splitting the files across line breaks in the wixDir funtion. |
awesome. If i did something wrong with the template then I'm happy to fix it there. but I'm lost. |
Just out of curiosity, if you change the icons and diff files to a separate definition, like this: let diffMerge = wixDir TRUE true (directoryInfo(bundledDir @@ "diffmerge"))
let icons = wixDir TRUE true (directoryInfo(bundledDir @@ "icons"))
let replacements = [
"@build.number@",
if isGitlabCI then "6.16.42." + buildVersion
elif not isLocalBuild then buildVersion else "0.1.0.0"
"@product.productcode@",System.Guid.NewGuid().ToString()
"@HelpFiles@",getFilesAsWiXString helpFiles
"@ScriptFiles@",getFilesAsWiXString scriptFiles
"@gitnav@",wixDir TRUE false (directoryInfo(deployPrepDir))
"@diffmerge@", diffMerge
"@icons@", icons
"@pspad@",wixDir TRUE true (directoryInfo(bundledDir @@ "PsPad"))
"@winmerge@",wixDir TRUE true (directoryInfo(bundledDir @@ "WinMergePortable"))
"@diffmergeComponents@", getComponentIdsFromWiXString diffMerge
"@iconsComponents@", getComponentIdsFromWiXString icons
"@pspadComponents@",wixComponentRefs (directoryInfo(bundledDir @@ "PsPad"))
"@winmergeComponents@",wixComponentRefs (directoryInfo(bundledDir @@ "WinMergePortable"))] Does it work with the old version of wixDir then? |
that seems to help a bit, but I still get a very very long list:
|
I reactivated your commit, but I hope you can help me to get my stuff working with your changes. |
How about this? let diffMerge = wixDir TRUE true (directoryInfo(bundledDir @@ "diffmerge"))
let icons = wixDir TRUE true (directoryInfo(bundledDir @@ "icons"))
let winMerge = wixDir TRUE true (directoryInfo(bundledDir @@ "WinMergePortable"))
let psPad = wixDir TRUE true (directoryInfo(bundledDir @@ "PsPad"))
let replacements = [
"@build.number@",
if isGitlabCI then "6.16.42." + buildVersion
elif not isLocalBuild then buildVersion else "0.1.0.0"
"@product.productcode@",System.Guid.NewGuid().ToString()
"@HelpFiles@",getFilesAsWiXString helpFiles
"@ScriptFiles@",getFilesAsWiXString scriptFiles
"@gitnav@",wixDir TRUE false (directoryInfo(deployPrepDir))
"@diffmerge@", diffMerge
"@icons@", icons
"@pspad@", psPad
"@winmerge@", winMerge
"@diffmergeComponents@", getComponentIdsFromWiXString diffMerge
"@iconsComponents@", getComponentIdsFromWiXString icons
"@pspadComponents@", getComponentIdsFromWiXString psPad
"@winmergeComponents@", getComponentIdsFromWiXString winMerge] I can't check if this covers everything, but it should get a lot better and we certainly will get it going ;) It is very important, that every file is included in at least one feature. So when defining your files and directories in the node, make sure that all of them are referenced in your feature. |
with the same change for @gitnav@ it makes light.exe happy. Now it fails on candle. ;-(
|
In your template you have </Directory>
@gitnav@
<Directory Id="HELPDIR" Name="Help"> Because of your own change, the component Ref is inserted. But you should leave this XML node as it is, for the rest, I suggest the following: let diffMerge = wixDir TRUE true (directoryInfo(bundledDir @@ "diffmerge"))
let icons = wixDir TRUE true (directoryInfo(bundledDir @@ "icons"))
let winMerge = wixDir TRUE true (directoryInfo(bundledDir @@ "WinMergePortable"))
let psPad = wixDir TRUE true (directoryInfo(bundledDir @@ "PsPad"))
let gitNav = wixDir TRUE false (directoryInfo(deployPrepDir))
let replacements = [
"@build.number@",
if isGitlabCI then "6.16.42." + buildVersion
elif not isLocalBuild then buildVersion else "0.1.0.0"
"@product.productcode@",System.Guid.NewGuid().ToString()
"@HelpFiles@",getFilesAsWiXString helpFiles
"@ScriptFiles@",getFilesAsWiXString scriptFiles
"@gitnav@", gitNav
"@diffmerge@", diffMerge
"@icons@", icons
"@pspad@", psPad
"@winmerge@", winMerge
"@diffmergeComponents@", getComponentIdsFromWiXString diffMerge
"@iconsComponents@", getComponentIdsFromWiXString icons
"@pspadComponents@", getComponentIdsFromWiXString psPad
"@winmergeComponents@", getComponentIdsFromWiXString winMerge
"@gitNavComponents@", getComponentIdsFromWiXString gitNav] and adding this to the XML: </Directory>
<Feature Id="Feature.Core"
Title="GitNav Core Components"
Description="GitNav"
Display="expand"
ConfigurableDirectory="GITNAVPATH"
Level="1"
Absent="disallow"
AllowAdvertise="no">
<ComponentRef Id="Help"/>
<ComponentRef Id="HelpStyles"/>
<ComponentRef Id="Scripts"/>
<ComponentRef Id="ProfileScript"/>
<ComponentRef Id="prepDeploy"/>
<ComponentRef Id="Microsoft.VC90.CRT"/>
<ComponentRef Id="RegistryEntries" />
<ComponentRef Id="Console2"/>
<ComponentRef Id="Log2Console"/>
@diffmergeComponents@
@iconsComponents@
@pspadComponents@
@winmergeComponents@
@gitNavComponents@
</Feature> |
No Problem :) |
I just realized that the current implementation of wixDir somewhat limits major upgrades.
The current implementation generates random GUIDs for the component IDs on each build.
This is a big problem for Windows Installer, since it uses the component GUID for identifying components through each update.
When upgrading with random IDs, your old files are all deleted, so potentially existing edited config files will be reset.
My fix makes use of WiX auto-generated GUIDs, which stay the same throughout upgrades, if the target path of the component is not changed.
In addition to that, I create separate components for each file, which is a best practice for ensuring resiliency.