Wix:在构建时有条件地添加文件
你好 我所处的情况是我需要在构建时有条件地包含一堆文件。
我需要一些技巧来使用预处理器变量来设置要在构建时包含在安装程序中的特定文件组。
我尝试过 同时定义如下:
<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>
即引用父文件中的目录和功能。但 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在这种情况下我会完全避免包含。相反,创建文件和组件并将它们分组到单独片段的组件组中。然后在您的功能中有条件地包含 ComponentGroupRefs。例如,假设您有一个 files.wxs ,例如(想象更多文件;):
然后在 Product.wxs 中:
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 ;):
Then in product.wxs:
糟糕,我在错误的位置添加了包含文件。对片段感到困惑,文件被包含在仅应与引用一起驻留的位置之后。
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.