Wix: conditionally adding files during build

Hi. I am in a situation where I need to include a bunch of files conditionally in Build Time .

I need some tips on using Pre-Processor variables to set a specific group of files to be included in the installer in Build Time.

I experimented with <? include Group1.wxi ?>, defining as folloiwng:

<Include>
  <DirectoryRef Id="PLANTROOT">
    <!--Adding Plugins======= Start ==-->
    <Directory Id="Plugins" Name="Plugins">
      <Directory Id="PIW_Plugin" Name="PIW">
        <Merge Id='PIWtoIDGNConverter' Language='0' SourceFile='PIWtoIDGNConverter.msm' FileCompression='yes' DiskId='1' />
        <Directory Id="Dir_ECFramework" Name="ECFramework" >
          <Merge Id='ECFrameworkMergeModule' Language='0' SourceFile='ECFrameworkMergeModule.msm' FileCompression='yes' DiskId='1' />
    </Directory>
        </Directory>
      </Directory>
    </Directory>
    <!--Adding Plugins=======Stop==-->
  </DirectoryRef>

<FeatureRef Id="PIWMain">
    <!--Sub Feature for PIW 2 IDGN Converter Plugin-->
    <Feature Id="PIW_imodel_OWL_Plugin" AllowAdvertise="no" Description="PIW i-model &amp; OWL" Display="expand" Level="1" Title="PIW i-model &amp; OWL" InstallDefault="followParent">
      <MergeRef Id='PIWtoIDGNConverter' />
      <MergeRef Id='ECFrameworkMergeModule' />
      <MergeRef Id='ECObjectsMergeModule' />
      <MergeRef Id='PlatformSdkBinariesMergeModule'  />
      <!-- <MergeRef Id='ECFW_LicenseClient'  /> -->
      <MergeRef Id='ManagedLogClientMergeModule'  />
      <MergeRef Id='ECClassEditor'  />
      <MergeRef Id='ClassEditorRDSPlugin'  />
      <MergeRef Id='SQLDbECPluginMergeModule'  />
      <MergeRef Id='SQLDbECCEExtensionMergeModule'  />
    </Feature>
  </FeatureRef>

That is, referring to the directory and function in the parent file. But wxi does not accept DirectoryRef and FeatureRef

Any help would be greatly appreciated.

Thanks and best regards

+3
source share
2 answers

. ComponentGroups . () ComponentGroupRefs. , , .wxs ( ;):

<Fragment>
  <ComponentGroup Id="Foo">
    <Component Directory="DirectoryId">
       <File Source="path\to\file.ext"/>
    </Component>
  </Component>
</Fragment>

product.wxs:

<Product ...>
  <Feature Id="F">
    <?ifdef IncludeFiles ?>
       <ComponentGroupRef Id="Foo" />
    <?endif?>
  </Feature>
</Product>
+4

, include . , , .

0

Source: https://habr.com/ru/post/1780236/


All Articles