Announcement

Collapse
No announcement yet.

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

Collapse
X
 
  • 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:	91
Size:	5.5 KB
ID:	306073

    Ulrich

    Comment


    • #3
      No, Standard.

      Comment


      • #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.

        Ulrich

        Comment


        • #5
          Revisiting this. I have an existing .msifact setup file and I'd like to use it if I can? It has all my custom dialogs, etc in it.

          How would you suggest I do the above in a custom bootstrapper using my existing .msifact file?

          Comment


          • #6
            I took my existing .msifact, added the bootstrapper based on the Extract and Run Single MSI, renamed the MSI in the list of files to "mainsetup", but I get this error:



            Generating bootstrapper...

            LZMA 9.38 beta : Igor Pavlov : Public domain : 2015-01-03

            LZMA 9.38 beta : Igor Pavlov : Public domain : 2015-01-03
            Indigo Rose MSI Bootstrapper
            Copyright (c) 2015 Indigo Rose Corporation - www.indigorose.com
            Initialize folders...
            Loading configuration file...
            Copy setup executable stub...
            Writing Version Resources...
            Adding bootstrapper execution level manifest...
            Adding files...
            c:\temp\mainscript.lua.tmp
            c:\temp\_global_functions.lua.tmp
            msi
            ERROR: LZMA compression failed: msi -> c:\temp\sfwD8D6.tmp
            Cleaning up temporary files...
            Bootstrap build failed: 6

            LZMA 9.38 beta : Igor Pavlov : Public domain : 2015-01-03

            Error: can not open input file msi
            Error 1011: IRMakeBootstrap.exe returned error: 6
            Deleting temporary files

            Build FAILED! Error: 1011 - Error executing pre/post build step

            Comment


            • #7
              I did the "Build" from the main interface and the above was my result.

              Then I clicked on Build from the Bootstrapper app toolbar and it created the .exe. Looks to have the .MSI embedded too, but when I try and run it, it says
              "Failed to extract setup file. (3701)"

              Comment


              • #8
                I had the ID not set to "mainsetup". Works now!

                Comment


                • #9
                  Why does the EXE show "$(ProductName)" when it is extracting files? I have all the fields filled out in the .xml file, and under Settings I have the product name filled out.

                  Comment


                  • #10
                    I suspect you did not read/do this:

                    Click image for larger version

Name:	SCRN-2022-03-18-01.png
Views:	23
Size:	49.0 KB
ID:	308330

                    Ulrich

                    Comment


                    • #11
                      is that when building the MSI with "msi factory.exe" or bulding the EXE with "irmakebootstrap.exe"?

                      Comment


                      • #12
                        This is for the bootstrapper.

                        Click image for larger version  Name:	SCRN-2022-03-18-03.png Views:	0 Size:	26.9 KB ID:	308333

                        The other option is to code the variables, such as the value needed for strProductName, directly into the script, as mentioned in the comment I highlighted above. In this case you would not need to pass arguments (command line options), but this is up to you.

                        Ulrich

                        Comment


                        • #13
                          I put it after the irbootstrap.exe and it worked great. Thanks again!

                          Comment

                          Working...
                          X