This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- ADDLOCAL and feature condition evaluation
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
Mar 15, 2012
05:41 AM
ADDLOCAL and feature condition evaluation
Hi all,
I have multuple features in a basic msi project.
one of them needs to be disabled on full UI and enabled only on SILENT mode using a "secret" property. meaning, that even if the user passes the feature in ADDLOCAL list, it should not be installed unless the property was set as well in command line.
I tried adding a feature condition using a new property, and passing the property before ADDLOCAL on cmd.
Unfortunately, as far as I can see, Feature conditions are evaluated only if ADDLOCAL is not set. Therefore, when not including the feature on ADDLOCAL with the rest of the required features, the feature condition does not get evaluated and the feature does not get installed. when including it on ADDLOCAL - it gets installed without checking the condition.
I have been struggling with this a lot,
would appreciate your help.
Thanks,
Sharon.
I have multuple features in a basic msi project.
one of them needs to be disabled on full UI and enabled only on SILENT mode using a "secret" property. meaning, that even if the user passes the feature in ADDLOCAL list, it should not be installed unless the property was set as well in command line.
I tried adding a feature condition using a new property, and passing the property before ADDLOCAL on cmd.
Unfortunately, as far as I can see, Feature conditions are evaluated only if ADDLOCAL is not set. Therefore, when not including the feature on ADDLOCAL with the rest of the required features, the feature condition does not get evaluated and the feature does not get installed. when including it on ADDLOCAL - it gets installed without checking the condition.
I have been struggling with this a lot,
would appreciate your help.
Thanks,
Sharon.
(1) Reply
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
Mar 15, 2012
10:18 AM
Create a CA and have a condition if running silent to run it. You can basically go through your features and re-add them to ADDLOCAL and REMOVE checking their FeatureState to see if it is already installed:
[HTML]
myList = ListCreate(STRINGLIST);
ListAddString(listID,"Feature1", AFTER);
etc...
nResult = ListGetFirstString(myList,featureName);
while (nResult != END_OF_LIST)
MsiGetFeatureState (hMSI, featureName, nvInstallState, nvActionState);
if nvInstallState = INSTALLSTATE_LOCAL then
// add to Addlocal flag
else
if secretProperty = OK then
Addlocalflag=true;
else
Addlocalflag=false;
endif;
endif;
if AddLocal then
if strAddlocal = "" then
strAddlocal = featureName;
else
strAddlocal = strAddlocal + "," + featureName;
endif;
else
if strRemoveFlag = "" then
strRemove = featureName;
else
strRemove = strRemove + "," + featureName;
endif;
endif;
nResult = ListGetFirstString(myList,featureName);
endwhile;
MsiSetProperty(hMSI, "ADDLOCAL", strAddlocal );
MsiSetProperty(hMSI, "REMOVE", strRemove );
endif;[/HTML]
Or if you know what features are to be installed - just add them directly to the ADDLOCAL and REMOVE variables.
[HTML]
myList = ListCreate(STRINGLIST);
ListAddString(listID,"Feature1", AFTER);
etc...
nResult = ListGetFirstString(myList,featureName);
while (nResult != END_OF_LIST)
MsiGetFeatureState (hMSI, featureName, nvInstallState, nvActionState);
if nvInstallState = INSTALLSTATE_LOCAL then
// add to Addlocal flag
else
if secretProperty = OK then
Addlocalflag=true;
else
Addlocalflag=false;
endif;
endif;
if AddLocal then
if strAddlocal = "" then
strAddlocal = featureName;
else
strAddlocal = strAddlocal + "," + featureName;
endif;
else
if strRemoveFlag = "" then
strRemove = featureName;
else
strRemove = strRemove + "," + featureName;
endif;
endif;
nResult = ListGetFirstString(myList,featureName);
endwhile;
MsiSetProperty(hMSI, "ADDLOCAL", strAddlocal );
MsiSetProperty(hMSI, "REMOVE", strRemove );
endif;[/HTML]
Or if you know what features are to be installed - just add them directly to the ADDLOCAL and REMOVE variables.