18

我正在尝试使简单的 Windows 更加安装,但我不知道如何处理这个问题。我有两个功能 - 功能 1 和功能 2。我希望仅在用户选择要安装的 feature1 时才安装 feature2。所以我尝试了:

<Feature Id='core' Title='Core'
         Description='ØMQ 1.0.0 core functionality and C++ API' Level='1'>
  <ComponentRef Id='Core_include' />
  <ComponentRef Id='Core_bin' />
  <ComponentRef Id='Core_lib' />
  <ComponentRef Id='Core_zmq' />
  <ComponentRef Id='cpp_bin' />
</Feature>

<Feature Id='core_perf' Title='core_perf' Description='0MQ core perf' Level='999'>
    <Condition Level="0">NOT (&amp;core = "3")</Condition>
        <ComponentRef Id='cpp_perf' />
</Feature>

但是,如果用户选择功能核心,这不会安装功能 core_perf。

我怎样才能解决这个问题?

4

2 回答 2

16

您需要将您的 Condition 移动到您的 Component 定义中,并使用 ! (功能状态)而不是 & (功能操作),以便在您尝试通过第二次重新运行安装来添加示例时它可以工作:

<Component Id="example1">
    <Condition>!feature1 = 3</Condition>
</Component>

<Component Id="example2">
    <Condition>!feature2 = 3</Condition>
</Component>

<Feature Id="feature1">
</Feature>

<Feature Id="feature2">
</Feature>

<Feature Id="examples">
    <ComponentRef Id="example1" />
    <ComponentRef Id="example2" />
</Feature>
于 2009-07-21T15:16:46.457 回答
7

您是否考虑过让 feature1 成为 feature2 的父级?除非同时安装 feature1,否则无法安装 feature2。不需要条件。

<Feature Id='core' Title='Core' 
         Description='ØMQ 1.0.0 core functionality and C++ API' Level='1'>
    <ComponentRef Id='Core_include' />
    <ComponentRef Id='Core_bin' />
    <ComponentRef Id='Core_lib' />
    <ComponentRef Id='Core_zmq' />
    <ComponentRef Id='cpp_bin' />
    <Feature Id='core_perf' Title='core_perf' Description='0MQ core perf' 
             Level='999'>
        <ComponentRef Id='cpp_perf' />
    </Feature>
</Feature>
于 2013-01-09T23:44:53.887 回答