【发布时间】:2017-07-12 12:49:18
【问题描述】:
我正在学习 Wix 安装程序,并且要求 msi 是多次安装程序。
我的问题是如何在不将命令行上的 InstallDir 指定为 msiexec 的情况下,将 INSTALLFOLDER 从 WWTagNet.Service 更改为 WWTagNet.Service1、WWTagNet.Service2、WWTagNet.Service3?
我使用了 InstanceTransforms 元素并定义了三个实例,并添加了 MultiInstance="yes" 一些组件。
我想我认为我指定为 INSTALLFOLDER 的目录会根据 InstanceID 自动更改。
我只想将 InstanceID 附加到 INSTALLFOLDER,而不是将其指定为 msiexec 的命令行。
我已经尝试使用以下方法,但它似乎不起作用。
<SetProperty Id="INSTALLFOLDER" After="LaunchConditions" Sequence="first" Value="[TARGETDIR][ProgramFilesFolder][Company][INSTANCEID]"><![CDATA[NOT Installed]]></SetProperty>
这些是我的 product.wxs 文件的相关部分。
<Property Id="INSTANCEID" Value="0" />
<InstanceTransforms Property="INSTANCEID">
<Instance Id="I01" ProductCode="a4d890ed-e624-438e-8fd9-938cd7aa06be" ProductName="Service1" />
<Instance Id="I02" ProductCode="17c81aa7-0524-44f7-a2ea-3a618c9ceb6b" ProductName="Service2" />
<Instance Id="I03" ProductCode="8d858d7c-f66c-4ccb-9427-77b5c426c3e1" ProductName="Service3" />
</InstanceTransforms>
<Feature Id="ProductFeature" Title="WWTagNet.Service" Level="1">
<ComponentGroupRef Id="ProductComponents" />
<ComponentGroupRef Id="Modules" />
</Feature>
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="COMPANYFOLDER" Name="W W Wood Products Inc">
<Directory Id="INSTALLFOLDER" Name="WWTagNet.Service">
<Directory Id="MODULESFOLDER" Name="Modules" />
</Directory>
</Directory>
</Directory>
</Directory>
</Fragment>
<Fragment>
<ComponentGroup Id="Modules" Directory="MODULESFOLDER">
<!--Install some files-->
</ComponentGroup>
<ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
<!--Install some files-->
</ComponentGroup>
</Fragment>
【问题讨论】:
标签: wix