How to set the level of feature based on condition in wix?

前端 未结 2 903
滥情空心
滥情空心 2020-12-10 09:09

I am trying to install the features based on the condition. Initially i set the feature level to 1 and place a condition inside the feature to modify the feature level.

相关标签:
2条回答
  • 2020-12-10 09:29

    How to use WiX feature conditions is essentially explained here: https://www.firegiant.com/wix/tutorial/getting-started/conditional-installation/

    For a feature to be set to the level specified by your condition, the condition has to evaluate to true. You can force it to be true by setting it to 1:

    <Feature Id="AddinsFeature" Title="InstallAddin" Level="1" Absent="allow">
    
      <!-- Force condition to be true, which sets the feature to the Level attribute value -->
      <Condition Level="0">1</Condition>
    
      <ComponentRef Id = "AddInComp"/>
    </Feature>
    

    Above we force the feature's install level to 0 because its condition of 1 is true (the number 1 is true in MSI logic - by definition - as in boolean). In the real world the condition would be something much more complicated - of course.

    Every setup has an overall INSTALLLEVEL - and it acts as a high water mark as explained here by Chris Painter. Every feature which evaluates to a feature level below or at the INSTALLLEVEL gets installed by default.

    Note: When you set the Feature level to 0 in your WiX source, the feature is not show in the setup GUI and it is not going to be installed by default either (more details in link below).

    Feature manipulation can be very involved. A few links:

    • How to install feature based on the property set in custom action?
    • Unselected Feature Being Installed (over the top detailed)
    • Failing condition wix (Level=0 hides feature from GUI)
    • http://www.joyofsetup.com/2008/04/09/feature-states-in-component-conditions/
    0 讨论(0)
  • 2020-12-10 09:50

    You can ship the components present inside the feature by setting the condition 'True' like below. Whenever the property 'SAMPLEFEATURE_UNLOCKED' sets to true, the feature is unlocked.

    0 讨论(0)
提交回复
热议问题