No announcement yet.

How to run a command after msi is built, but before exe is made

  • Filter
  • Time
  • Show
Clear All
new posts

  • How to run a command after msi is built, but before exe is made

    I need to sign the MSI file and also the final EXE file. I can't use the built-in sign code because it doesn't work with EV certs, so I run the signtool command "After Build". This works fine for signing the EXE, but is there a way to run a command after the MSI is created, but before the EXE is built? This way I'll have a signed MSI and a signed EXE. Some customers extract the MSI from the EXE, while others just want the MSI, so I need to have it signed. Thank you.

  • #2
    Are you using the "custom" bootstrapper?

    Click image for larger version

Name:	SCRN-2021-02-01-01.png
Views:	60
Size:	5.5 KB
ID:	306073



    • #3
      No, Standard.


      • #4
        Understood. To achieve what you want, I suggest that you use the "Custom" option.

        Go to Tools > Bootstrapper Designer, create a new project based on the "Extract and Run Single MSI" template.
        Add your existing MSI file to the list of files, and give it the ID "mainsetup".
        Save the bootstrapper project, and build to see if there are errors.
        Run the exe which was created, and see if the MSI starts normally.

        If everything is okay, you can now build everything from the command line. Set the bootstrapper to "None" and save the updated project. You can now build the MSI with a batch file (see the "Unattended Build Options" in the MSI Factory help file), then you can sign the MSI by invoking signtool with the /a parameter, then run the bootstrapper builder project (again, command line parameters can be found in the docs, see "Using IRMakeBootstrap.exe" in the bootstrapper help file), and the fourth and final step would be calling signtool again, but now to sign the executable.

        The bootstrapper built in this manner can still process the "/EXTRACTMSI" command line argument, allowing your client to save the MSI if needed, but it gives you more much options than the standard option.