1

I am trying to extract msi using administrative install in order to create patch, but it is not extracting all the components, I suspect this is due to the conditional install element which works fine in regular install

<Feature Id="SomeFeature" Level="0">
        <ComponentGroupRef Id="Somecomponent" />
        <ComponentGroupRef Id="Somecomponents" />
       <Condition Level="1"><![CDATA[(SOMEPROP = "true") OR (REMOVE ~= "ALL")]]></Condition>
      </Feature>

is it possible to use condition element for administrative install? SOMEPROP property value is true by default and is changed on some custom action which i believe wont run in administrative install.

  • 1
    I am just heading out right now, but have a read of [**this answer towards the bottom**](https://stackoverflow.com/a/49868953/129130) - the "UPDATE" section. I never finished researching this issue back then - it wasn't a priority. – Stein Åsmul Aug 31 '20 at 14:46
  • thanks a lot @SteinÅsmul, could you shed some light on "I guess the tentative conclusion is to not set any features to Level=0, but set Level=1 and then set them to Level=0 with a feature condition that evaluates to true." referring to the answer you shared above. – rishabh singh Sep 01 '20 at 10:19
  • 1
    As far as I recall the idea was to default the feature level to 1 or some other positive value and then to set it back to 0 (hide it) with a condition statement that evaluates to true (as in when this is true I want to hide the feature). See [this answer](https://stackoverflow.com/a/12504033/129130) on [INSTALLLEVEL](https://learn.microsoft.com/en-us/windows/win32/msi/installlevel) as a "high water mark" to control default feature selection and [one more answer here](https://stackoverflow.com/a/52218618/129130) on the same topic. – Stein Åsmul Sep 01 '20 at 10:29
  • And [the WiX markup towards the bottom here too](https://stackoverflow.com/a/49868953/129130). – Stein Åsmul Sep 01 '20 at 10:34
  • thanks a lot @SteinÅsmul – rishabh singh Sep 02 '20 at 10:25

1 Answers1

2

According to the Windows Installer SDK:

A feature with an installation level of 0 (zero) is not installed during any installation, including administrative installations.

You need to reverse your logic so that the feature is installed by default and conditionally disabled.

Bob Arnson
  • 21,377
  • 2
  • 40
  • 47
  • Thanks Bob, so you are basically saying to remove the conditional install logic? – rishabh singh Sep 01 '20 at 10:22
  • 1
    You can still do that but the feature should be level 1 and use a Condition element to set it to 0. That way it's enabled during an admin install. – Bob Arnson Sep 01 '20 at 14:24