[wix-users] Custom actions with properties
Ewan
ewan.sinclair at vigilantapps.com
Fri Jun 2 05:00:02 PDT 2017
Hey everyone!
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
install.log/
This installs the product into the install folder correctly. Here is a
cleaned version of my Product.wxs:
/ <Fragment>//
// <Directory Id="TARGETDIR" Name="SourceDir">//
// <Directory Id="WindowsVolume">//
// <Directory Id="INSTALLFOLDER" Name="myProgram">//
// <a bunch more directories in here>//
// </Directory>//
// </Directory>//
// <CustomAction Id="RunOnInstall" Directory="INSTALLFOLDER"
ExeCommand="[INSTALLFOLDER]\bin\Install.bat" Execute="deferred"
Return="check" HideTarget="no" Impersonate="no" />//
// <CustomAction Id="RunOnUninstall" Directory="INSTALLFOLDER"
ExeCommand="[INSTALLFOLDER]\bin\Uninstall.bat" Execute="deferred"
Return="ignore" HideTarget="no" Impersonate="no" />//
// <InstallExecuteSequence>//
// <Custom Action="RunOnInstall" After="InstallFiles">NOT
Installed</Custom>//
// <Custom Action="RunOnUninstall"
Before="RemoveFiles">Installed</Custom>//
// </InstallExecuteSequence>//
// </Fragment>/
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:
ActionStart(Name=RunOnInstall,,)//
//MSI (s) (4C:3C) [11:57:21:730]: Executing op:
CustomActionSchedule(Action=RunOnInstall,ActionType=3106,Source=C:\/_/*TestMe*/_/\,Target=C:\/_/*TestMe*/_/\\bin\Install.bat,)/
And here is the RunOnUninstall action
/MSI (s) (4C:E0) [11:57:41:101]: Executing op:
ActionStart(Name=RunOnUninstall,,)//
//MSI (s) (4C:E0) [11:57:41:101]: Executing op:
CustomActionSchedule(Action=RunOnUninstall,ActionType=3170,Source=C:\/_/*myProgram*/_/\,Target=C:\/_/*myProgram*/_/\\bin\Uninstall.bat,)/
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!
-E
More information about the wix-users
mailing list