I have a WiX installer that includes this declaration of directories:
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFiles64Folder">
<Directory Id="MyCorp" Name="MyCorp">
<Directory Id="INSTALLFOLDER" Name="FlowApp">
<Directory Id="FLOW_COMPONENTS" Name="Components"/>
<Directory Id="FLOW_CONFIGURATION" Name="Configuration"/>
</Directory>
</Directory>
</Directory>
</Directory>
And I have a dialog to allow the install folder location to be changed:
<Fragment>
<UI>
<Dialog Id="LocationDialog" Title="FlowMaster 3000 server deployment" Width="370" Height="270" NoMinimize="no">
<Control Id="PathLabel" Type="Text" Text="Install folder" X="10" Y="30" Width="70" Height="15" TabSkip="yes"/>
<Control Id="InstallPath" Type="Edit" Property="INSTALLFOLDER" Text="{80}" X="100" Y="30" Width="260" Height="15" />
This works fine when the location is not changed, but when the location is changed by the user, although the INSTALLFOLDER variable is correctly changed, the FLOW_COMPONENTS and FLOW_CONFIGURATION variables retain their original paths. See log:
Action start 14:38:59: CostFinalize.
MSI (c) (B8:B0) [14:38:59:308]: Dir (target): Key: INSTALLFOLDER , Object: C:\Program Files\MyCorp\FlowApp\
MSI (c) (B8:B0) [14:38:59:308]: Dir (target): Key: FLOW_COMPONENTS , Object: C:\Program Files\MyCorp\FlowApp\Components\
MSI (c) (B8:B0) [14:38:59:308]: Dir (target): Key: FLOW_CONFIGURATION , Object: C:\Program Files\MyCorp\FlowApp\Configuration\
Action 14:39:03: LocationDialog. Dialog created
MSI (c) (B8:48) [14:39:07:302]: PROPERTY CHANGE: Modifying INSTALLFOLDER property. Its current value is 'C:\Program Files\MyCorp\FlowApp\'. Its new value: 'D:\Program Files\MyCorp\FlowApp\'.
Action start 14:39:37: ExecuteAction.
MSI (s) (64:20) [14:39:39:652]: PROPERTY CHANGE: Adding INSTALLFOLDER property. Its value is 'D:\Program Files\MyCorp\FlowApp\'.
MSI (s) (64:20) [14:39:39:652]: PROPERTY CHANGE: Adding FLOW_CONFIGURATION property. Its value is 'C:\Program Files\MyCorp\FlowApp\Configuration\'.
MSI (s) (64:20) [14:39:39:653]: PROPERTY CHANGE: Adding FLOW_COMPONENTS property. Its value is 'C:\Program Files\MyCorp\FlowApp\Components\'.
Which leads to an attempt to create the sub-folders under a folder that doesn't exist.
What should I add to have the change of the install folder's path flow to its sub-folders?
EDIT
The directories are populated. One in a separate wxs file with a group of files harvested by Heat, and the other like this:
<ComponentGroup Id="Configuration" Directory='FLOW_CONFIGURATION'>
<Component Id="Install.json" Guid="MY_GUID" >
<File Id="Install.json" Name="Install.json" Source="$(var.SolutionDir)Configuration\Install.json" KeyPath="yes" />
</Component>
</ComponentGroup>
I initially had the component groups referenced simply in my feature:
<Feature Id="Everything" Level="1" Display='expand' ConfigurableDirectory='INSTALLFOLDER'>
<ComponentGroupRef Id="Components" />
<ComponentGroupRef Id="Configuration" />
</Feature>
But I've now made them sub-features with their own ConfigurableDirectory attribute:
<Feature Id="Everything" Level="1" Display='expand' ConfigurableDirectory='INSTALLFOLDER'>
<Feature Id="SubComponents" ConfigurableDirectory='FLOW_COMPONENTS'>
<ComponentGroupRef Id="Components" />
</Feature>
<Feature Id="SubConfiguration" ConfigurableDirectory='FLOW_CONFIGURATION'>
<ComponentGroupRef Id="Configuration" />
</Feature>
</Feature>
I don't notice a difference either way.
Did you try using custom actions?
You can use one of these custom action to change the property value during install:
For example:
2.Schedule the action during the InstallExecution phase (must be after the CostFinalize step):