No announcement yet.

Need to run a executable during the installation

  • Filter
  • Time
  • Show
Clear All
new posts

  • Need to run a executable during the installation

    I have set up a custom action that runs an executable. The file is one that is installed with the product. On the settings tab, in the Location section, I have selected the file with the "Installed with product" radio button on the custom action builder. But I am getting errors when running the install. I have been trying to find the correct spot in the sequence to run it and have tried several different places. Can anyone tell me how to set up the timing so this will actually work. Thanks in advance for any help.

  • #2
    First of all, please be advised that it is not recommended to run the program at the end of the install, because the current user was elevated during the install, therefore the user rights during this initial run may not correspond to the same settings when the same application is run normally for a second time, after the install. This elevation could cause that configurations are stored with incorrect settings or at incorrect locations. If you still want to do this, here are some options:

    Method 1

    Use a bootstrapper to execute the file after the installation of the MSI package.

    Method 2

    Set up a Custom Action to run the program, and adjust the timing to "After InstallFinalize".

    Method 3

    Attach the execution of the file to the "Finish" button on the final screen.

    1) Open the Custom Actions, and edit the RUNEXE action, set Condition to "Not INSTALLED"

    2) Delete the entry below "Timing";

    3) Under "Options", set Return to "Async no wait";

    4) Close both dialogs with OK;

    5) In the "User Interface" pane on the left, click "Dialogs";

    6) Change the edit mode to "Advanced";

    7) Expand "Install Completed Successfully" and click "ExitDialog";

    8) In the preview of the dialog on the right, double-click the "Finish" button;

    9) Select the "Published Events" tab;

    10) Add Event "DoAction", Arguments "RUNEXE";

    11) Click Ok three times, rebuild the installer and test it.

    This method is also mentioned here:

    Method 4



    • #3
      Thank you for the detailed reply, but I am still having some problems with this. Some background, I am trying to run an installed executable with the /REGSERVER parameter. So I think it is ok and actually desired to run elevated. If not, it will not be able to register things correctly.

      Methods 3 and 4 are not really an option as they require dialogs and this install can be run in "silent mode" with no UI,

      Method 1: When I try to run an executable from the bootstrapper, I get an error 1013. I get that error if I try to run with the "/REGSERVER" parameter or even with no params to just run the executable. I assume this is a Windows system error, which means it is "Could not write to the registry". I am using the File.Run() method to do this.

      Method 2 is what I would prefer. When I try this I get an error 2762. I have tried several ways to invoke the custom action. I have been using the scheduling option of "Deferred - Commit", which I think is correct. I have also been using the location as "Installed with product". For timing, I have tried After InstallFinalize and On exit (success). But both still give the 2762 error.

      Any ideas or guidance would be much appreciated.


      • #4
        Hello Dale,

        You have current maintenance. If you wish, please open a support ticket, and attach the current project file and the matching installation log file, if you have one. (You can attach a zip file containing multiple logs, if you need.) I should be able to make this work for you or point you the way, once I understand clearly where the issue is.



        • #5
          I got it to work by putting the custom action BEFORE InstallFinalize using method 2 above. Thanks for your help.