View Full Version : Use of Feature and Component State Values (&Feature)
01-17-2006, 03:37 PM
Can i use a condition containing the Feature and Component State Values in a condition for a component?
My project has three features
I have components under Task that I only want to install if web isn't being installed. So i tried setting the condition to "Not (&Web=3)"
Can i not do that?
01-17-2006, 09:49 PM
The only problem with this that I can think of is how would the feature action operator ( & ) behave during a repair or change operation?
"For example, the conditional expression "&MyFeature=3" evaluates to True only if MyFeature is changing from its current state to the state of being installed on the local computer, INSTALLSTATE_LOCAL."
So I'm thinking that if a user did an install the component would not be installed but that if the user went back and reinstalled only the Web feature that the components would get installed.
I havn't done this before so be sure to test this, I could be wrong.
01-18-2006, 07:47 AM
The Condition field enables or disables a component only during the CostFinalize action. To enable or disable a component after CostFinalize, you must use a custom action or the DoAction ControlEvent to call MsiSetComponentState.
01-18-2006, 08:36 AM
Right, the SDK says & can be used "after" CostFinalize, but I wonder if it could be used during CostFinalize?
CostFinalize is determining the feature actions and component selection so I wonder which happens first during the action.
All I can say is try it and see what happens, thats how I "learn" what is often written in the SDK, but not quite obvious in the SDK.
For example SDK says"
"The following table shows the feature and component state values used in conditional expressions. These states are not set until MsiSetInstallLevel is called, either directly or by the CostFinalize action."
So it can be inferred that the code inside CostFinalize makes a call to MsiSetInstallLevel.
01-18-2006, 11:58 AM
I found that feature action states (&FeatureName) don't work in component conditions. Haven't tried feature installed states.
01-18-2006, 12:00 PM
Also, Kristan's original post sounds as if the conditions should be based on feature selections during the dialog phase, which is after CostFinalize.
01-18-2006, 12:01 PM
Feature and component states do not work with component and feature conditions until after costfinalize (where it's no longer helpful). So basically &Feature or $Component do not work from component/feature conditions.
However, the installed state, so !Feature and ?Component, will work in the context of a CostFinalize aciton - but obviously wouldn't be too useful unless you were repair or something like that.
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.