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 does one add a CA for uninstallation?


8 replies to this topic

madmaxandme

madmaxandme
  • Members
  • 14 posts

Posted 08 April 2002 - 17:04

Hi all,

Is it even possible to add a Custom Action for uninstallation?  (probably violates best-setup policy huh)  Somewhere in the sequence?  How does uninstallation work basicall?

It's hard to find documentation.  Thanks-

Stefan Krueger

Stefan Krueger

    InstallSite.org

  • Administrators
  • 13,269 posts

Posted 08 April 2002 - 20:26

This is possible, and not unusual. All you have to do is put a proper condition on the custom action, e.g. use the action property of your main features (see "conditional statement syntax" in MSI Help for details)

madmaxandme

madmaxandme
  • Members
  • 14 posts

Posted 09 April 2002 - 17:03

But where can I get a list of all conditonal statements?

Version9X
VersionNT >= 500
Not Installed
AdminUser
SystemLanguageID = 1033

This is all statements MSI help offers (same w/ Bob Baker reference)

Would there be an "uninstallation" or something?

Thanks-

Stefan Krueger

Stefan Krueger

    InstallSite.org

  • Administrators
  • 13,269 posts

Posted 09 April 2002 - 18:57

For example:
&YourMainFeature=2
will be true if your feature called YourMainFeature (this should be your top level feature) is being removed.

madmaxandme

madmaxandme
  • Members
  • 14 posts

Posted 11 April 2002 - 22:42

I'm not sure I understand.

I just would like to run a custom action during uninstallation, despite whichever feature(s) was or was not chosen.

So in the condition field for my desired uninstallation custom action, could I not put "if installed" or something so that the CA occurs at uninstall time only?

Thanks-

Irina

Irina
  • Members
  • 227 posts

Posted 12 April 2002 - 20:55

You can use a condition as REMOVE="ALL". It should work during the uninstallation.
Irina Shirinsky
Software Engineer, Heroix Corporation
http://www.heroix.com

madmaxandme

madmaxandme
  • Members
  • 14 posts

Posted 15 April 2002 - 17:30

Thank you all for the reply,

but I still don't get it.  Ok, from scratch.  Let's say I want to include this test script:

function FunctionTest(hMSI)
begin
MessageBeep ( 0 );
end;

I just want this function to run during uninstallation, meaning having the machine beep.

I created a CA with this function called FunctionTest.  Then, I added this CA after InstallFinalize in the sequence.  Then, I added the REMOVE="ALL" condition to the CA.  

I then ran the uninstall, but I get no test beep.

So does it matter for uninstallation where I place the CA?  Or does that depend solely on the condition.  In any case, I was unsuccessful getting the beep.

Thanks-

madmaxandme

madmaxandme
  • Members
  • 14 posts

Posted 16 April 2002 - 21:23

Oops, that was easy everybody.

Just set the CA to immediate, and in the condition field, enter "Installed".  That's it!

hteichert

hteichert
  • Members
  • 158 posts

Posted 17 April 2002 - 09:21

No, sorry, but it's not as easy as you think.

"Installed" will be set if the product is already installed. In your test configuration there will also be a beep when modifying the installation. You can't use "Installed" to detect the uninstallation - it only tells you if the product is already installed or not. Normally it's used to run actions only during installation, not on modifications or uninstalls.

I also asked myself why is there no special condition for uninstall? Thinking about it a bit longer led me to the conclusion that normally there's no need for it.
Seen from MSIs point of view there are features and components, let's have a look at them:

A user might select to uninstall one of several installed features during a modification. Is this an uninstall? Yes, it's an uninstall of this special feature (and nothing else) and if there are any special actions to be taken during the uninstall of this feature they should be started with conditions connected to this feature (see "Conditional Statement Syntax" in MSI help).

Be careful when building conditions on components, because components might already be installed before your product gets installed or might stay after your product is uninstalled - they may be in use by another installed application.

If you really want to build actions on the uninstall of your product, you could use the following workaround:
Create an empty, invisible feature in your setup and build conditions on this feature. If your product is completely uninstalled, this feature will be removed, too (Condition: &MyHiddenFeature=2).

Holger
h.teichert-ott