我有一个包含此目录声明的 WiX 安装程序:
<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>
我有一个对话框允许更改安装文件夹的位置:
<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" />
这在位置未更改时可以正常工作,但是当用户更改位置时,尽管正确更改了 INSTALLFOLDER 变量,但 FLOW_COMPONENTS 和 FLOW_CONFIGURATION 变量仍保留其原始路径。见日志:
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\'.
这导致尝试在不存在的文件夹下创建子文件夹。
我应该添加什么来更改安装文件夹的路径流向其子文件夹?
编辑
目录已填充。一个在单独的 wxs 文件中,其中包含由 Heat 收集的一组文件,另一个像这样:
<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>
我最初在我的功能中简单地引用了组件组:
<Feature Id="Everything" Level="1" Display='expand' ConfigurableDirectory='INSTALLFOLDER'>
<ComponentGroupRef Id="Components" />
<ComponentGroupRef Id="Configuration" />
</Feature>
但我现在用它们自己的 ConfigurableDirectory 属性使它们成为子功能:
<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>
两种方式我都没有注意到区别。