0
votes

I am new to Wix and am making a script that among other things need to kill the application if it is running. I also need to remove a file from the startup folder that have been place there by previous versions of the application before we used an msi for the installation.

My current custom actions look like this:

   <InstallExecuteSequence>
     <Custom Action='KillSuperbolt' Before='InstallValidate'/>
     <Custom Action='LaunchInstalledExe' After='InstallFinalize'/>
  </InstallExecuteSequence>

  <Property Id="QtExecCmdLine" 
      Value='"[WindowsFolder]\System32\taskkill.exe" /F /T /IM Superbolt.exe'/>

  <CustomAction Id="KillSuperbolt" 
          BinaryKey="WixCA" 
          DllEntry="CAQuietExec" 
          Execute="immediate" 
          Return="ignore"/>

  <CustomAction Id="LaunchInstalledExe"
     FileKey="SuperboltLauncherExe"
     ExeCommand="" 
     Execute="immediate" 
     Impersonate="yes" 
     Return="asyncNoWait" />

I tried to do as in this post: http://windows-installer-xml-wix-toolset.687559.n2.nabble.com/multiple-immediate-Quiet-Execution-custom-actions-td7591578.html

But i can not have two Properties with Id="QtExecCmdLine" and it does not give any clue of how to connect a property with a custom action.

1

1 Answers

1
votes

I found the answer myself, and it was to change the value of the property before the second command is executed:

  <InstallExecuteSequence>
    <Custom Action='KillSuperbolt' Before='InstallValidate'/>
    <Custom Action='RemoveStartup' After ='InstallValidate'/>
    <Custom Action='LaunchInstalledExe' After='InstallFinalize'/>
  </InstallExecuteSequence>

  <Property Id="WixQuietExecCmdLine" 
      Value='"[WindowsFolder]\System32\taskkill.exe" /F /T /IM Superbolt.exe'/>

  <CustomAction Id="KillSuperbolt" 
          BinaryKey="WixCA" 
          DllEntry="WixQuietExec" 
          Execute="immediate" 
          Return="ignore"/>

  <SetProperty Id='WixQuietExecCmdLine' Before='RemoveStartup' Sequence='execute' Value='"[WindowsFolder]\System32\cmd.exe" /c del "[ProgramMenuFolder]Startup\Superbolt.lnk"'/>

  <CustomAction Id="RemoveStartup"
      BinaryKey="WixCA"
      DllEntry="WixQuietExec"
      Execute="immediate"
      Return="ignore"/>

<CustomAction Id="LaunchInstalledExe"
     FileKey="SuperboltLauncherExe"
     ExeCommand="" 
     Execute="immediate" 
     Impersonate="yes" 
     Return="asyncNoWait" />