How to Uninstall Feature
Posted 02 January 2006 - 19:23
How can i uninstall one feature depending upon some condition.
A sample code will really help.
Posted 01 February 2006 - 11:38
In the Feature View (of the feature you want to install conditionaly) you'll find Level propery set to 1 (the default value) and a Condition property empty.
Edit the condition property and set this
Level : 1000
Condition : NOTINSTALLIFMYCONDITION
NOTINSTALLIFMYCONDITION is an arbitrary public property but you may also use a private property like Version9X
I choose 1000 because it's greater than 100 (the INSTALLLEVEL value)
Now you have to set NOTINSTALLIFMYCONDITION if you want to not install this Feature. If the condition evaluates to false, your feature will use its default Install Level property, but if the condition evaluates to true, an alternative Install Level will be used.
In this example, the alternative Install Level is 1000 and the default is 1.
In your script you may set NOTINSTALLIFMYCONDITION using MsiSetProperty
export prototype set_NOTINSTALLIFMYCONDITION (HWND);
function set_NOTINSTALLIFMYCONDITION (hMSI)
if(........) then MsiSetProperty(hMSI, "LAUNCHADOBEREADERSETUP", "1"); endif;
Posted 01 February 2006 - 11:57
Actually i am not using MSI , i am using Installscript instead.
Also i need to uninstall the feature(s) based upon the input from a user not install it conditionally.
Posted 01 February 2006 - 12:15
MsiSetProperty(ISMSI_HANDLE, "NOTINSTALLIFMYCONDITION", "1");
You may also use FeatureSelectItem
Edited by lavocat, 01 February 2006 - 12:16.
Posted 01 February 2006 - 18:30
if CONDITION then
FeatureSelectItem ( MEDIA, "Feature1", TRUE );
FeatureSelectItem ( MEDIA, "Feature2", FALSE );
TRUE selects the feature for installation, FALSE de-selects the feature. By default your features will be selected for installation. You can change the default value by going to "Setup Types."
Edited by bhagelin, 01 February 2006 - 18:30.