cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
scottd72
Level 7

Technique question: put component into multiple features, or create common feature?

There have been many times in which a certain component in my project is needed in more than one feature (usually because the different features get built with different products). When such a case arises I've avoided putting the component in multiple features. Instead, I create a single "common" feature that has release flags to indicate it will get built with multiple products, and I put the component in that feature. I've always been opposed to putting components into more than one feature, thinking that it is cleaner to create common features instead. But even this approach can get messy. Is one technique better than the other? Is there a "best practices" way of handling this situation?
Labels (1)
0 Kudos
(2) Replies
Cary_R
Level 11

I am aware of one caveat that will bite you, and it is subtle.

It has to do with multi-feature membership of the built *.msi package.

If you use release flags to include a component into features that are mutually exclusive across your builds, you are probably OK. However, this situation is what you have to watch out for:

[LIST=1]
  • Component A belongs to multiple features (feature A and feature B)
  • User selects custom install, selects both Feature A and Feature B
  • User changes mind and deselects Feature B
  • Component now doesn't get installed, even though it belongs to Feature A, which is getting installed.



    What is happening here is that the SelectionTree dialog performs a "Select" operation that toggles components underneath each of the features. Since the last operation in the above example is a "Toggle Off" for all components under Feature B, you end up losing Component A.

    This is a strong case for a Common feature that you just put some conditions on. If certain builds need to not install the Common Feature, then put a condition on that feature that checks against the ISReleaseFlags property for certain release flags:

    http://helpnet.installshield.com/installshield16helplib/IHelpCustomActionsReleaseFlags.htm

    You can also do this on a Component level. Of course, once you start getting into multiple features with different destinations, at a certain point it starts to make sense to just use the DuplicateFile table, or multiple components, etc.
  • 0 Kudos
    scottd72
    Level 7

    That's a pretty nasty gotcha. Thanks for the info, I'll stick with using Common features.
    0 Kudos