在Wix中设置ComponentGroupRef的目录? [英] Setting directory of ComponentGroupRef in Wix?

查看:149
本文介绍了在Wix中设置ComponentGroupRef的目录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I have used the Heat tool to generate a wxs file based on a folder whose contents I want to install. This gives me a large file like this:

<?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.该功能看起来像这样:

In my main Wix file, Product.wxs, I have a feature that references the above ComponentGroup that was created by Heat. The feature looks something like this:

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

这是可行的,但是当我运行安装程序时,组件组中的文件位于C驱动器的根目录(即C:\ DirectoryName)中,但我希望它们进入程序文件"(例如C:\程序文件\目录名).

This is working but when I run my installer, the files within the component group are placed in the root of the C drive (i.e. C:\DirectoryName) but I would like them to go into Program Files (e.g. C:\Program Files\DirectoryName).

有什么想法吗?

谢谢, 艾伦

推荐答案

您可以使用-dr参数传递要引用的目录的ID,例如

You can pass the Id of the directory you want to reference to heat with the -dr argument like

heat -dr AutogeneratedComponentsDir

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

Or DirectoryRefId attribute if you are using the HeatDirectory task in msbuild.

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

Then just define the location of that directory in your main Product.wxs.

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

这篇关于在Wix中设置ComponentGroupRef的目录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆