[wix-users] Custom actions with properties
ewan.sinclair at vigilantapps.com
Fri Jun 2 05:00:02 PDT 2017
I've been having a spot of trouble using custom actions with properties
passed in via the command line at runtime. I have an INSTALLFOLDER
property that i use to represent where the user wants the program
installed (as the name suggests). The user can either run the msi which
uses a default value, or the user can provide the property from the
command line arguments. So when I'm installing, i run this command to
provide the install folder:
/msiexec /i //myProgram//Installer.msi INSTALLFOLDER=c:\TestMe /L*V
This installs the product into the install folder correctly. Here is a
cleaned version of my Product.wxs:
// <Directory Id="TARGETDIR" Name="SourceDir">//
// <Directory Id="WindowsVolume">//
// <Directory Id="INSTALLFOLDER" Name="myProgram">//
// <a bunch more directories in here>//
// <CustomAction Id="RunOnInstall" Directory="INSTALLFOLDER"
Return="check" HideTarget="no" Impersonate="no" />//
// <CustomAction Id="RunOnUninstall" Directory="INSTALLFOLDER"
Return="ignore" HideTarget="no" Impersonate="no" />//
// <Custom Action="RunOnInstall" After="InstallFiles">NOT
// <Custom Action="RunOnUninstall"
As you can see, I have a couple of custom actions that I run upon
install and uninstall. When i just run the MSI by itself without
providing the install folder property, both CA's are executed fine.
However, when the MSI is installed via command line, providing the
install folder property, the install CA is called but the uninstall CA
is not. I did a bit of digging into the log files, this is the call of
the RunOnInstall action on the install:
/MSI (s) (4C:3C) [11:57:21:728]: Executing op:
//MSI (s) (4C:3C) [11:57:21:730]: Executing op:
And here is the RunOnUninstall action
/MSI (s) (4C:E0) [11:57:41:101]: Executing op:
//MSI (s) (4C:E0) [11:57:41:101]: Executing op:
As far as i can tell, the uninstall CA hasn't been provided with the
install folder property, even though it was provided in the product
defination? Ive tried uninstalling the MSI on its own, and providing the
installfolder property in the uninstall command line:
msiexec /x myInstaller.msi INSTALLFOLDER=c:\TestMe /L*V uninstall.log
And neither seem to call the uninstall action properly. So im at a bit
of a loss. Is it a bug with Wix, or have i just configured the CA's it
wrong? Any help you can provide is greatly appreciated!
Thanks in advance!
More information about the wix-users