How can I find if I'm currently in uninstallation mode? Also if I turned on "allow adding or removing components", how can I find if I'm removing the entire application or removing individual components?

Looks like the "pre-uninstallation actions" don't get execuated if I chose removing individual components.

asked 06 Jun '12, 21:06

gt8967884's gravatar image

gt8967884
101747678
accept rate: 12%


For detecting if an action is in installer or uninstaller, you can simply set a variable in <initializationActionList> and then just do a check. For example:

<initializationActionList>
  <setInstallerVariable>
    <name>is_running_installer</name>
    <value>1</value>
  </setInstallerVariable>
</initializationActionList>

Then you can simply check it by doing:

<isTrue>
  <value>${is_running_installer}</value>
</isTrue>

For checking if an action is run in uninstaller, the rule should just be <ifFalse>.

Regarding if the uninstaller is going to uninstall entire application, the <preUninstallationActionList> and <postUninstallationActionList> for <project> is only run when uninstalling application, so actions that should clean up the application should be run from <project> ones.

Also, <preUninstallationActionList> for <project> is run before ones for components (and are the first actions run in uninstaller), you can simply set a variable and check it in other actions:

<preUninstallationActionList>
  <setInstallerVariable>
    <name>is_uninstalling_application</name>
    <value>1</value>
  </setInstallerVariable>
</preUninstallationActionList>
link

answered 07 Jun '12, 02:15

wojciechka's gravatar image

wojciechka ♦♦
7.8k61122
accept rate: 26%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×54

Asked: 06 Jun '12, 21:06

Seen: 793 times

Last updated: 07 Jun '12, 02:15