组件组中的 Wix 子目录

Wix SubDirectories in ComponentGroups

我想为我的组件组预定义子文件夹。

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
  <?include Constants.wxi?>
  <Fragment>

    <ComponentGroup Id="CG.MYLIBRARY" Directory="INSTALLFOLDER">
      <Component Id="C.MYLIBRARY" Guid="*">
        <File Id="MYLIBRARY" Source="$(var.MyProject.TargetPath)" KeyPath="yes" Checksum="yes" />
      </Component>


      <ComponentGroupRef Id="CG.DependencyLibrary" />

      <!-- Resources -->

      <Component Directory="Configuration">
        <File Id="MyFile" Source="$(var.MyProject.TargetPath)\Configuration\MyFile" />
      </Component>

    </ComponentGroup>
  </Fragment>
</Wix>

所以我希望 MyLibrary.dll 在我的 TopDirectory - "INSTALLFOLDER", 但我想在名为 Configuration.

的子目录中自动 MyFile.xml
#InstallFolder
-> MyLibrary.dll
-> DependencyLibrary.dll
#InstallFolder\Configuration
--> MyFile.xml

但是当我那样尝试时 - 我只得到:

The Component/@Directory attribute cannot be specified when the Component element is nested underneath a Directory element. If this Component is a member of a ComponentGroup where ComponentGroup/@Directory is set, then the Component/@Directory attribute should be removed.

为什么我必须删除 Directory-Element,而我只想要我的组件组中给定目录下的子文件夹?

我不使用这个构造 (ComponentGroup),但是这个编译:

<...>

<Fragment>
 <Directory Id="TARGETDIR" Name="SourceDir">
  <Directory Id="ProgramFilesFolder">
    <Directory Id="INSTALLFOLDER" Name="SetupProject4">
      <Directory Id="Configuration" />
    </Directory>
  </Directory>
 </Directory>
</Fragment>

<...>

<Fragment>
 <ComponentGroup Id="ProductComponents">      
    <Component Id="C.MYLIBRARY" Directory="INSTALLFOLDER">
       <File Source="1.txt" />
    </Component>
    <Component Directory="Configuration">
       <File Source="2.txt" />
    </Component>
 </ComponentGroup>
</Fragment>