WiX: Changing the directory path does not change the path to the subdirectory?

I have a WiX installer that includes this directory declaration:

<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 that allows me to change the location of the installation folder:

 <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 does not change, but when the user changes the location, although the INSTALLFOLDER variable is correctly changed, the FLOW_COMPONENTS and FLOW_CONFIGURATION variables retain their original paths. See Journal:

 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\'. 

This leads to an attempt to create subfolders in a folder that does not exist.

What should I add to change the flow of the installation folder path to my subfolders?

EDIT

The catalogs are full. One in a separate wxs file with a group of files compiled by Heat, and the other one 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> 

At first, I had groups of components that were referenced simply in my function:

 <Feature Id="Everything" Level="1" Display='expand' ConfigurableDirectory='INSTALLFOLDER'> <ComponentGroupRef Id="Components" /> <ComponentGroupRef Id="Configuration" /> </Feature> 

But now I have made them helper functions with my 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 see no difference in any way.

+4
source share
1 answer

Have you tried using custom actions?

You can use one of these custom actions to change the value of a property during installation:

  • custom action that changes the value of a catalog property scheduled before CostFinalize
  • a custom action of type 35 that changes the directory path (should be scheduled after CostFinalize)

For instance:

 <CustomAction Id="ChangeDir" Directory="INSTALLFOLDER" Value="[SomeValueorPropertyhere]"/> 

2. Expand the action in the InstallExecution step (it should be after the CostFinalize step):

 <Custom Action="ChangeDir" After="CostFinalize"></Custom> 
+4
source

Source: https://habr.com/ru/post/1501356/


All Articles