0
votes

I've got an MSI built in WiX defined as below:

<Feature Id="Core"
         Display="0"
         Absent="disallow"
         ConfigurableDirectory="INSTALLDIR"
         AllowAdvertise="no"
         Level="1">...</Feature>

I have a 'commit' custom action that loops through all the features of the MSI and determines their install-state. The log file shows this "Core" feature as installed 'Local', but MsiGetFeatureState returns INSTALLSTATE_ADVERTISED. I thought that was impossible given I set:

AllowAdvertise="no"

FWIW, MsiGetFeatureState correctly returns INSTALLSTATE_LOCAL for all other installed features and INSTALLSTATE_ABSENT for all other not-installed features.

Edit for more info:

  • This occurs during a fresh install.
  • I do not set the ADVERTISE property (I still don't fully understand what it's for)
  • The "Core" feature is a parent feature with children that all have the wix attribute InstallDefault="followParent".
  • The "Core" feature (as well as its children) all have components attached to them.
  • All the child features are marked as INSTALLSTATE_ADVERTISED as well.
  • I have a commit custom action (scheduled before InstallFinalize) that queries the installed feature states ([ProductCode] is passed in via CustomActionData). I assumed that a commit action was the right choice since the MSI is officially installed by that point.
2
This question leaves out a lot of necessary context. Is this a first-time install, or during or after a minor upgrade? How are you invoking the session that finds that the feature is advertised? Did you set the ADVERTISE property somewhere? See msidbFeatureAttributesDisallowAdvertise on Feature TableMichael Urman
Is the feature maybe just a parent (maybe with sub-features) and has no actual component content?PhilDW
Original post updated...jbudreau
I'd look at a verbose log to see explicitly what it says is happening to the Core feature. It's still not clear to me if (for example) it's in the ADDLOCAL list.PhilDW
It looks like the ADDLOCAL property isn't explicitly set in my install. Is that something that I should be doing? I thought it was done by default when InstallValidate executed...jbudreau

2 Answers

1
votes

AllowAdvertise="no" turns into msidbFeatureAttributesDisallowAdvertise in the Feature table, which says:

Note that this bit works only with features that are listed by the ADVERTISE Property.

IOW, if it became advertised for some other reason, this bit won't stop that.

0
votes

Found out what the problem was (I think).

I had a custom action that would call MsiSetComponentState() to set a component to INSTALLSTATE_ABSENT if some condition was true. This means that my 'Core' feature was intended to have every attached component set to INSTALLSTATE_LOCAL, but since this one component was manually forced into INSTALLSTATE_ABSENT the 'Core' feature (once installed) is considered to have an install state of 'Advertised'. An additional consequence was that during uninstall all components attached to the 'Core' feature were getting left behind. Their action states were NULL (do nothing) instead of Absent (remove).

Moral of the story, don't use MsiSetComponentState() to turn off a component at install time.