在wix的子文件夹中添加所有项目

Posted

技术标签:

【中文标题】在wix的子文件夹中添加所有项目【英文标题】:Add all items in a subfolder in wix 【发布时间】:2015-04-29 13:45:19 【问题描述】:

我正在尝试使用 wix 在子文件夹中添加所有项目,但无法使其正常工作。我要包含的文件夹是 SourceDir\cgis\plugins。我试过以下命令:

heat.exe dir "C:\builds\5\Agile\Enhancements\Sources\cgis\Plugins" -cg "PLUGINS" -gg -dr "INSTALLDIR" -out "C:\builds\5\Agile\Enhancements\Sources\Installer\InstallerFiles\PLUGINSAutoGenerated.wxs"

但是生成的 wix 文件的所有路径都设置为“SourceDir\Plugins”,并且不包括“cgis”路径。我认为是“INSTALLDIR”部分搞砸了。我该如何解决这个问题?

这是生成的 wix 文件...

<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
  <Fragment>
    <DirectoryRef Id="INSTALLDIR">
      <Directory Id="dirFBC2981AD00F77A864B229D586A8FF4A" Name="Plugins" />
    </DirectoryRef>
  </Fragment>
  <Fragment>
    <ComponentGroup Id="PLUGINS">
      <Component Id="cmp7D6D1821410032777186B326A94B0074" Directory="dirFBC2981AD00F77A864B229D586A8FF4A" Guid="CB140BBA-A0F1-4DC4-9F52-EC52D37F4FB1">
        <File Id="fil3199D322312FCF2E65220EE1D32E9D01" KeyPath="yes" Source="SourceDir\plugins.xml" />
      </Component>
      <Component Id="cmp6E9AE677B75D04E674FA3600540B1625" Directory="dir3B79D62CB22DDE06ACABFE4C349DC3D5" Guid="F51DE300-28E8-4DA6-9E04-B4F889F0A847">
        <File Id="fil1DA820DF22A14405DA2283F347562788" KeyPath="yes" Source="SourceDir\FCE98F84-D42F-4849-ABAC-40B8C0681CCA\config.xml" />
      </Component>
      <Component Id="cmp8DAD3F1FB1522629C192166C154C3A2A" Directory="dir3F8AA07072F01F9DE0D4ECCECD604EF4" Guid="F2D082E5-B1D3-4A84-B526-99547BE0DE3A">
        <File Id="filDB175FB5E01053A10C735912DE80795D" KeyPath="yes" Source="SourceDir\FCE98F84-D42F-4849-ABAC-40B8C0681CCA\Resources\config.htm" />
      </Component>
      <Component Id="cmpC8D27078EA051EC23DCF06532A177C29" Directory="dir3F8AA07072F01F9DE0D4ECCECD604EF4" Guid="95CABEFB-3001-4002-8500-333B7934E638">
        <File Id="fil955421CB1EF3331E272E34CF27EC98A3" KeyPath="yes" Source="SourceDir\FCE98F84-D42F-4849-ABAC-40B8C0681CCA\Resources\config.js" />
      </Component>
      <Component Id="cmp6A18228B64852E3965F5B08302B1BFE6" Directory="dir3F8AA07072F01F9DE0D4ECCECD604EF4" Guid="6DB30523-AF43-4707-B56B-BA41735B9D80">
        <File Id="fil101FAD959EBBDC663B02415E44CBEA5D" KeyPath="yes" Source="SourceDir\FCE98F84-D42F-4849-ABAC-40B8C0681CCA\Resources\editquestion.htm" />
      </Component>
      <Component Id="cmp7B3C7804DC1AC1264E496AF4C0257472" Directory="dir3F8AA07072F01F9DE0D4ECCECD604EF4" Guid="D069AE5A-CFFB-40C3-8FFB-CB182CBB5851">
        <File Id="fil9DDE5D2879BE190C6B522B922923E007" KeyPath="yes" Source="SourceDir\FCE98F84-D42F-4849-ABAC-40B8C0681CCA\Resources\Invite.htm" />
      </Component>
      <Component Id="cmp70098E40BCE6D583D32192EA9D0F27AE" Directory="dir3F8AA07072F01F9DE0D4ECCECD604EF4" Guid="E6F526D8-E16D-4908-A9FC-732689156F8E">
        <File Id="fil617D430BB9E459F67655DD2B52A3CEFA" KeyPath="yes" Source="SourceDir\FCE98F84-D42F-4849-ABAC-40B8C0681CCA\Resources\manageposition.htm" />
      </Component>
      <Component Id="cmp560F53E98D173EAD5938035EC67798E4" Directory="dir3F8AA07072F01F9DE0D4ECCECD604EF4" Guid="ACF50CF2-06DD-4611-9F43-78F4C85621B5">
        <File Id="fil720812FA3F9F621EB8C2367DA7FB9125" KeyPath="yes" Source="SourceDir\FCE98F84-D42F-4849-ABAC-40B8C0681CCA\Resources\present.htm" />
      </Component>
      <Component Id="cmp71B59D692FE6223BC7A8D71E4F735C3A" Directory="dir3F8AA07072F01F9DE0D4ECCECD604EF4" Guid="A0A37806-CBC0-4403-8703-CC2FCB4274A8">
        <File Id="filF660600A71B9A682F7A855C11FB2D8F7" KeyPath="yes" Source="SourceDir\FCE98F84-D42F-4849-ABAC-40B8C0681CCA\Resources\present.js" />
      </Component>
      <Component Id="cmp8C216AE888AE23D9B30C37F00D8F7916" Directory="dir3F8AA07072F01F9DE0D4ECCECD604EF4" Guid="C7A2EF9A-62E7-4065-A1F6-717421B7DB4A">
        <File Id="fil8E34957DF91061CB256C47D02702B954" KeyPath="yes" Source="SourceDir\FCE98F84-D42F-4849-ABAC-40B8C0681CCA\Resources\results.htm" />
      </Component>
      <Component Id="cmp89C31F6E30A85F33F4DF1AC88F321152" Directory="dir3F8AA07072F01F9DE0D4ECCECD604EF4" Guid="9F6F0E18-5F38-474F-8CF6-E674DABB499F">
        <File Id="fil719870ADFE89377CAC14F76531334931" KeyPath="yes" Source="SourceDir\FCE98F84-D42F-4849-ABAC-40B8C0681CCA\Resources\styles.css" />
      </Component>
    </ComponentGroup>
  </Fragment>
  <Fragment>
    <DirectoryRef Id="dirFBC2981AD00F77A864B229D586A8FF4A">
      <Directory Id="dir3B79D62CB22DDE06ACABFE4C349DC3D5" Name="FCE98F84-D42F-4849-ABAC-40B8C0681CCA" />
    </DirectoryRef>
  </Fragment>
  <Fragment>
    <DirectoryRef Id="dir3B79D62CB22DDE06ACABFE4C349DC3D5">
      <Directory Id="dir3F8AA07072F01F9DE0D4ECCECD604EF4" Name="Resources" />
    </DirectoryRef>
  </Fragment>
</Wix>

【问题讨论】:

请参考这个问题***.com/questions/26550763/…我已经给出了答案。 【参考方案1】:

我已经很久没用过这个工具了,但也许可以试试:

heat.exe dir "C:\builds\5\Agile\Enhancements\Sources" -gg -sfrag -out "C:\builds\5\Agile\Enhancements\Sources\Installer\InstallerFiles\PLUGINSAutoGenerated.wxs"

我添加了-sfrag 以抑制目录和组件的片段生成,删除了-cg "PLUGINS"-dr "INSTALLDIR",然后我最终缩短了输入路径以停止在"Sources"。如果不对您的实际文件夹结构进行试验,就很难做到这一点,但请试一试。

我相信大多数人最终都会使用-var 标志:WIX Heat.exe command parameter -var does not accept spaces?

只是为了方便访问:Harvest Tool (Heat) command line reference

【讨论】:

以上是关于在wix的子文件夹中添加所有项目的主要内容,如果未能解决你的问题,请参考以下文章

卸载 WiX 时删除文件

WIX安装项目未完全卸载应用程序

如何为 Wix 刻录引导程序 exepackage 添加依赖文件夹

WiX MSI:将演示项目与安装程序捆绑在一起

在 Visual Studio 2008 中将目录添加到 CAB 项目

Wix 安装程序 - 未复制所有源和内容