0

我对 Wix 很陌生。

我从这个例子开始:

https://helgeklein.com/blog/2014/09/real-world-example-wix-msi-application-installer/

他有一个计算例程,它使用变量(实际上是如下所示的语言环境信息)计算出 INSTALLDIR。

<!-- All folders from here on are relative to their parent. -->

<Directory Id="ProgramFilesHK" Name="!(loc.ManufacturerName)">

  <!-- INSTALLDIR is a property name. We need it later for the UI (to be able to change the install dir. -->
  <Directory Id="INSTALLDIR" Name="!(loc.ApplicationName)">

其中(在示例中)解析为:

C:\Program Files (x86)\Helge Klein\uberAgent\

我正在尝试使 ProductCode 成为所有嵌套子文件夹的(最后一个)子文件夹。

阿卡,我想要:

C:\Program Files (x86)\Helge Klein\{22222222-2222-2222-2222-222222222222}\

我找到了这个:

在 Wix 中获取生成的 ProductCode 作为变量

所以我试图将代码更改为:

        <!-- INSTALLDIR is a property name. We need it later for the UI (to be able to change the install dir. -->
        <Directory Id="INSTALLDIR" Name="[PRODUCTCODE]">

并且

        <Directory Id="INSTALLDIR" Name="[ProductCode]">

不幸的是,这给了我

C:\Program Files (x86)\Apps\CCT\[ProductCode]\

而不是实际 ProductCode 的 Guid 值

我为什么要这样做?

我正在进行实例安装,并且

  <Property Id="INSTANCEID" Value="0"/>
  <InstanceTransforms Property="INSTANCEID">
    <Instance Id="I01" ProductCode="{22222222-2222-2222-2222-222222222222}" ProductName="My Product 01"/>
    <Instance Id="I02" ProductCode="{33333333-3333-4f1a-9E88-874745E9224C}" ProductName="My Product 02"/>
    <Instance Id="I03" ProductCode="{44444444-4444-5494-843B-BC07BBC022DB}" ProductName="My Product 03"/>
  </InstanceTransforms>

和这篇文章

http://ysdevlog.blogspot.com/2011/08/revisited-multiple-instance.html

说:

对于文件数据,这意味着将每个实例的文件安装到不同的位置——包含实例 ID 作为其一部分的路径最合适。

如何在这个“计算”安装目录逻辑中“获取”ProductCode?

谢谢。

不可用标签:Wix 3.10 版

请注意重复的问题“标签”。

这与Wix 安装程序不同 - 基于属性创建文件夹层次结构,因为宏值实际上是解析的。

这里的问题是宏值无法解析。

4

1 回答 1

0

你能把它添加到你的 wxs 中看看是否有效吗?

<CustomAction Id="SetInstallDir" Property="INSTALLDIR" 
              Value="[PRODUCTCODE]" 
              Execute="firstSequence" />

<InstallExecuteSequence>标签内:

<Custom Action="SetInstallDir" Before="CostFinalize">INSTALLDIR=""</Custom>
于 2017-01-14T17:14:53.097 回答