Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

How to Uninstall Feature


4 replies to this topic

AshokGupta

AshokGupta
  • Members
  • 12 posts

Posted 02 January 2006 - 19:23

I have two components/features in my installscript.
How can i uninstall one feature depending upon some condition.
A sample code will really help.

Thanks

lavocat

lavocat
  • Full Members
  • 158 posts

Posted 01 February 2006 - 11:38

Look in the Property Manager, You'll find a property called INSTALLLEVEL with an interger value (something like 100).

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
Example:

export prototype set_NOTINSTALLIFMYCONDITION (HWND);

function set_NOTINSTALLIFMYCONDITION (hMSI)
begin
if(........) then MsiSetProperty(hMSI, "LAUNCHADOBEREADERSETUP", "1"); endif;
end;



AshokGupta

AshokGupta
  • Members
  • 12 posts

Posted 01 February 2006 - 11:57

Thanks for response.
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.

lavocat

lavocat
  • Full Members
  • 158 posts

Posted 01 February 2006 - 12:15

So use ISMSI_HANDLE instead
MsiSetProperty(ISMSI_HANDLE, "NOTINSTALLIFMYCONDITION", "1");


You may also use FeatureSelectItem

Edited by lavocat, 01 February 2006 - 12:16.


bhagelin

bhagelin
  • Members
  • 22 posts

Posted 01 February 2006 - 18:30

Here is how you use FeatureSelectItem to select or de-select features from your install.


CODE


if CONDITION then

FeatureSelectItem ( MEDIA, "Feature1", TRUE );
FeatureSelectItem ( MEDIA, "Feature2", FALSE );

endif;



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.