Wix:在构建时有条件地添加文件

发布于 2024-10-07 13:03:14 字数 1881 浏览 0 评论 0原文

你好 我所处的情况是我需要在构建时有条件地包含一堆文件

我需要一些技巧来使用预处理器变量来设置要在构建时包含在安装程序中的特定文件组。

我尝试过 同时定义如下:

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

即引用父文件中的目录和功能。但 wxi 不接受 DirectoryRef 和 FeatureRef

任何帮助将不胜感激。

谢谢并致以诚挚的问候

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

I need some tips to use Pre-Processor variables to set a particular group of files to be included in the installer at Build Time.

I experimented with <? include Group1.wxi ?> while defining like 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 & OWL" Display="expand" Level="1" Title="PIW i-model & 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, referencing the Directory and Feature in Parent file. But wxi is not accepting DirectoryRef and FeatureRef

Any help would be greatly appreciated.

Thanks and best regards

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

〆一缕阳光ご 2024-10-14 13:03:14

在这种情况下我会完全避免包含。相反,创建文件和组件并将它们分组到单独片段的组件组中。然后在您的功能中有条件地包含 ComponentGroupRefs。例如,假设您有一个 files.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>

I would avoid Includes completely in this case. Instead, create your Files and Components and group them in ComponentGroups in separate Fragments. Then in your Feature(s) conditionally include ComponentGroupRefs. For example, let's say you have a files.wxs like (imagine more files ;):

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

Then in product.wxs:

<Product ...>
  <Feature Id="F">
    <?ifdef IncludeFiles ?>
       <ComponentGroupRef Id="Foo" />
    <?endif?>
  </Feature>
</Product>
软糖 2024-10-14 13:03:14

糟糕,我在错误的位置添加了包含文件。对片段感到困惑,文件被包含在仅应与引用一起驻留的位置之后。

Oops, I was adding the include file at wrong place. Was confused of Fragments and file was being included after where only should reside with references.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文