path - 在 Wix 中设置 ComponentGroupRef 的目录?

标签 path wix components heat

我已经使用 Heat 工具根据我要安装其内容的文件夹生成了一个 wxs 文件。这给了我一个像这样的大文件:

<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
    <Fragment>
        <DirectoryRef Id="TARGETDIR">
            <Directory Id="dir1FC8A0605F7DF8B33E3EECB0A1270FA2" Name="DirectoryName" />
        </DirectoryRef>
    </Fragment>
    <Fragment>
        <ComponentGroup Id="ComponentGroupId">
            <Component Id="cmp1FB67A60B41F3170889B7E5739A23560" Directory="dir1FC8A0605F7DF8B33E3EECB0A1270FA2" Guid="{2DC3B790-D29C-4090-B4CF-5C27687C6ABE}">
                <File Id="filF1E1262E52254B1846C7CB2393126A6F" KeyPath="yes" Source="PathToFile" />
            </Component>
        </ComponentGroup>
    </Fragment>
</Wix>

在我的主要 Wix 文件 Product.wxs 中,我有一个引用上述由 Heat 创建的 ComponentGroup 的功能。该功能看起来像这样:

<Feature Id="FeatureId" Title="FeatureTitle" Level="1" AllowAdvertise="no" Absent="disallow" Description="Feature description.">
    <ComponentGroupRef Id="ComponentGroupId" />
</Feature>

这是有效的,但是当我运行我的安装程序时,组件组中的文件被放置在 C 驱动器的根目录中(即 C:\DirectoryName),但我希望它们进入 Program Files(例如 C:\Program Files\DirectoryName)。

有什么想法吗?

谢谢, 艾伦

最佳答案

您可以使用 -dr 参数将要引用的目录的 Id 传递给 heat

heat -dr AutogeneratedComponentsDir

如果您在 msbuild 中使用 HeatDirectory 任务,则为 DirectoryRefId 属性。

然后只需在主 Product.wxs 中定义该目录的位置即可。

<Directory Id="TARGETDIR" Name="SourceDir">
  <Directory Id="ProgramFilesFolder">
    <Directory Id="INSTALLDIR" Name="YourProduct">
      <Directory Id="AutogeneratedComponentsDir"/>
    </Directory>
  </Directory>
</Directory>

关于path - 在 Wix 中设置 ComponentGroupRef 的目录?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6511851/

相关文章:

joomla - 在遗留类或 native 类中构建新的 joomla 组件?

objective-c - iOS Objective-C 图像文件名/路径在模拟器和设备之间的不同行为

windows - 在为 Windows 设置 Git 时改变了我对 PATH 的看法

java - 如何从UriInfo获取相对路径

iis - 在使用 WiX 安装网站之前停止 AppPool

c# - 错误 0x8007000b : Failed to create the managed bootstrapper application

java - 从文件路径设置壁纸

.net - 具有 32/64 位驱动程序的单个 32 位 MSI

vue.js - vuepress - 如何使用注册组件自定义组件目录 '.vuepress/components' 的位置?

pdf - 用于查看和注释 PDF 文档的组件