Discussion:
[WiX-users] Custom Uninstall action for only a single feature
John Robbins
19 years ago
Permalink
Hello,

Is there anyway to have a custom uninstall action if a particular
feature is installed. I've got the custom action working if the
application is installed, but need to narrow it down to only if a
feature is installed.

---- My feature ---
<Feature Id='WhoAmI'
Title='$(loc.VsWhoAmITitle)'
Description='$(loc.VsWhoAmIDescription)'
Display='expand'
Level='1'>
<ComponentGroupRef Id ='groupWhoAmIAddIn'/>
</Feature>

--- My current uninstall CAs. ---
<InstallExecuteSequence>
<!-- If installed, generate the uninstall command and execute it
(before removing any files) -->
<Custom Action="AddIns.Uninstall.Command"
Before="AddIns.Uninstall">
Installed
</Custom>
<Custom Action="AddIns.Uninstall"
Before="RemoveFiles">
Installed
</Custom>
</InstallExecuteSequence>

Thanks in advance!


John
Wintellect - Know How
http://www.wintellect.com
877-968-5528
Bob Arnson
19 years ago
Permalink
Post by John Robbins
Is there anyway to have a custom uninstall action if a particular
feature is installed. I've got the custom action working if the
application is installed, but need to narrow it down to only if a
feature is installed.
Assuming you want to run a CA when a particular feature is being
uninstalled, you can use the & prefix to get the feature's action state.
(Action state is what's happening now; ! is the prefix for install
state, which is the state of the feature before the current installer
started running.) The state for "being uninstalled" (or "not yet
installed," for the install state) is 2.

So your condition would be something like

&WhoAmI = 2

See
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/msi/setup/conditional_statement_syntax.asp
for details.
--
sig://boB
http://bobs.org
John Robbins
19 years ago
Permalink
The lesson: read Gábor DEÁK JAHN's amazing tutorial a little more carefully before asking question. <embarrassed grin>

<InstallExecuteSequence>
<!-- If the WhoAmI feature is installed, generate the uninstall
command and execute it (before removing any files) -->
<Custom Action="WhoAmI.Uninstall.Command"
Before="WhoAmIAddIn.Uninstall">
(!WhoAmI = 3)
</Custom>
<Custom Action="WhoAmIAddIn.Uninstall"
Before="RemoveFiles">
(!WhoAmI = 3)
</Custom>
</InstallExecuteSequence>


John
Wintellect - Know How
http://www.wintellect.com
877-968-5528

-----Original Message-----
From: John Robbins
Sent: Saturday, March 25, 2006 4:49 PM
To: wix-***@lists.sourceforge.net
Subject: Custom Uninstall action for only a single feature

Hello,

Is there anyway to have a custom uninstall action if a particular feature is installed. I've got the custom action working if the application is installed, but need to narrow it down to only if a feature is installed.

---- My feature ---
<Feature Id='WhoAmI'
Title='$(loc.VsWhoAmITitle)'
Description='$(loc.VsWhoAmIDescription)'
Display='expand'
Level='1'>
<ComponentGroupRef Id ='groupWhoAmIAddIn'/> </Feature>

--- My current uninstall CAs. ---
<InstallExecuteSequence>
<!-- If installed, generate the uninstall command and execute it
(before removing any files) -->
<Custom Action="AddIns.Uninstall.Command"
Before="AddIns.Uninstall">
Installed
</Custom>
<Custom Action="AddIns.Uninstall"
Before="RemoveFiles">
Installed
</Custom>
</InstallExecuteSequence>

Thanks in advance!


John
Wintellect - Know How
http://www.wintellect.com
877-968-5528
Bob Arnson
19 years ago
Permalink
Post by John Robbins
The lesson: read Gábor DEÁK JAHN's amazing tutorial a little more carefully before asking question. <embarrassed grin>
<InstallExecuteSequence>
<!-- If the WhoAmI feature is installed, generate the uninstall
command and execute it (before removing any files) -->
<Custom Action="WhoAmI.Uninstall.Command"
Before="WhoAmIAddIn.Uninstall">
(!WhoAmI = 3)
</Custom>
<Custom Action="WhoAmIAddIn.Uninstall"
Before="RemoveFiles">
(!WhoAmI = 3)
</Custom>
</InstallExecuteSequence>
That'll run when the feature is already installed, so would uninstall if
you do a repair. You want the &WhoAmI = 2 in there to check when the
feature is being uninstalled.
--
sig://boB
http://bobs.org
Continue reading on narkive:
Loading...