2011-06-28 41 views
3

我已经使用Heat工具根据要安装内容的文件夹生成wxs文件。这给了我一个很大的文件是这样的:在Wix中设置ComponentGroupRef的目录?

<?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> 

我主要的维克斯文件,Product.wxs,我有一个功能,引用是由热能产生上述ComponentGroup。该功能看起来是这样的:

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

这是工作,但是当我运行安装程序,组件组内的文件放在C盘的根目录(即C:\目录名),但我想他们进入程序文件(例如C:\ Program Files \ DirectoryName)。

任何想法?

感谢, 艾伦

回答

6

你可以通过你想,如果你正在使用中的MSBuild的HeatDirectory任务引用与-dr说法像

heat -dr AutogeneratedComponentsDir 

或者DirectoryRefId属性加热的目录编号。

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

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

非常感谢戴夫。轻松一旦你知道如何! –