wixwindows-installer

Using command line variable in msi custom action condition doesn't work


I am trying to control custom action by command line parameters, here are my msi scripts:

   ...
    <CustomAction Id='LaunchInstallQuiet'  FileKey='InstallImageFile' ExeCommand='-q' Execute="deferred" Return="check" Impersonate="yes" />
    <CustomAction Id='LaunchInstallQuietNonadmin'  FileKey='InstallImageFile' ExeCommand='-q -na' Execute="deferred" Return="check" Impersonate="yes" />
              
    <Property Id="NONADMIN" Secure="yes" Value="0" />

    <InstallExecuteSequence>
      <Custom Action='LaunchInstallQuiet' After='InstallFiles'>NONADMIN!="1" AND NOT REMOVE="ALL"</Custom>
      <Custom Action='LaunchInstallQuietNonadmin' After='InstallFiles'>NONADMIN="1" AND NOT REMOVE="ALL"</Custom>
      <ScheduleReboot After="InstallFinalize">Installed</ScheduleReboot>
    </InstallExecuteSequence>
   ...

but i get 2717 error for both following commands and custom action is not executed at all:

msiexec /i myapp.msi
msiexec /i myapp.msi NONADMIN=1

Solution

  • Thanks to @zett42, this works:

    <Custom Action='LaunchInstallQuiet' After='InstallFiles'><![CDATA[NONADMIN<>"1" AND NOT REMOVE="ALL"]]></Custom>