Search code examples
xmlwixwindows-installercustom-actionwix3.10

WiX toolset execute custom action after installation and wait for completion


I want to execute my .exe file, which displays MessageBox and exits upon clicking OK. CustomAction should be executed after installation is finished, but before displaying Finish dialog. Problem is, that I'm not able to set main installer window to wait for clicking on OK button (Finish dialog is displayed directly, therefore main window can be completely closed without clicking OK button). WiX Toolset version: v3.10

Product source code:

<Property Id="WixShellExecTarget" Value="[#ExeId]" />
<InstallExecuteSequence>
  <Custom Action="LaunchExe" After="InstallFinalize" />
</InstallExecuteSequence>
<CustomAction Id="LaunchExe" BinaryKey="WixCA" DllEntry="WixShellExec" Execute="immediate" Return="check" Impersonate="yes" />

Component source code:

<Component Id="ExeId" Directory="APPLICATIONFOLDER" Guid="*">
  <File Id="ExeId" Source=".\ExeName.exe" KeyPath="yes" Checksum="yes" />
</Component>

Solution

  • Ok I mannaged to run it. Resulting code is:

    <InstallExecuteSequence>
      <Custom Action="LaunchExe" Before="InstallFinalize">NOT Installed AND NOT REMOVE</Custom>
      </InstallExecuteSequence>
    <CustomAction Id="LaunchExe" FileKey="ExeId" ExeCommand="" Execute="deferred" Return="check" Impersonate="no" /> 
    

    Note that NOT Installed AND NOT REMOVE condition had to be added, because windows was not able to uninstall the application.