The Windows Installer has many built-in actions for the installation of applications. However, when a packager of an installation package finds it necessary to write a custom action. There are some best practices which have to be followed for optimal execution. A condition on the custom action, probably with a matching custom action to do the uninstall. Not sure what tools you're using, but assuming the secondary install is tied to a component, I would use that component state. A state of =3 means a target state of installed. A state = 2 means a target state of absent. It’s worth noting that Windows Installer doesn’t know whether a custom action is an install or an uninstall, which is how custom actions appear in the Visual Studio IDE. Visual Studio adds a condition to the custom actions that is true on an install or an uninstall, but you can’t see it in the IDE. This article on The Code Project will step you through adding a custom action DLL to a Windows Installer setup. MSI Custom Action DLL at The Code Project. Check if License Text was Completely Viewed. This C file includes the source code for a custom action that finds the License Agreement dialog of a setup and checks whether the text in the.
Active2 years, 4 months ago
I'm sure this is fairly easy, but I've kind of had a hard time with it. I've got a custom action that executes a different (non-msi) installer on installation. Unfortunately, I've noticed that it also executes the installer on UNinstallation!
I've looked through the options but I cant' seem to find out how to stop this. If anybody could help me I would be incredibly grateful.
Also, how do I set a custom action to go off only during UNinstall? Any help is greatly appreciated guys!
Cyprus106Cyprus106
2,41255 gold badges3434 silver badges4848 bronze badges
5 Answers
Add a condition on the action so it's only triggered during installation, not uninstallation.
Action run only during Install
Action runs during Install and repair
Run on initial installation only:
Run on initial install or when repair is selected.
To only run an action during uninstall use the following condition:
To only run an action during upgrade:
Cody S3,55477 gold badges2626 silver badges5858 bronze badges
saschabeaumontsaschabeaumont20.5k44 gold badges5656 silver badges8383 bronze badges
A bit of a correction:
Finally, to only run an action during uninstall use the following condition:
REMOVE='ALL'
This seems more appropriate as the property
So if I do a modify to remove one feature,
More details here on MSDN
REMOVE
contains the features being uninstalled.So if I do a modify to remove one feature,
REMOVE
is true and the action that was to execute only on uninstall executes on modify.More details here on MSDN
Windows Installer Custom Actions
Hakan Fıstık6,74988 gold badges4848 silver badges7474 bronze badges
Jean-Francois FortinJean-Francois Fortin
Windows Installer Custom Action Dll
An example:
Notice! Condition is added to the
<Custom>
tag and not the <CustomAction>
it confused me, because Custom is followed by Action attribuekristoffer_okristoffer_o
Please be careful with
And check below links for more details:
http://msdn.microsoft.com/en-us/library/aa371194(v=vs.85).aspx
http://msdn.microsoft.com/en-us/library/aa368013(v=vs.85).aspx
Hakan FıstıkREMOVE=ALL
. It is not available before installvalidate sequence. And check below links for more details:
http://msdn.microsoft.com/en-us/library/aa371194(v=vs.85).aspx
http://msdn.microsoft.com/en-us/library/aa368013(v=vs.85).aspx
6,74988 gold badges4848 silver badges7474 bronze badges
Anand ChoubeyAnand Choubey
A condition on the custom action, probably with a matching custom action to do the uninstall. Not sure what tools you're using, but assuming the secondary install is tied to a component, I would use that component state. A state of =3 means a target state of installed. A state = 2 means a target state of absent. Note that the state won't be set if there is no change.
Darren ClarkDarren Clark