Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. Using msi files in Qt Framework Installer
Forum Update on Monday, May 27th 2025

Using msi files in Qt Framework Installer

Scheduled Pinned Locked Moved Solved Installation and Deployment
9 Posts 4 Posters 2.1k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    stvokr
    wrote on 25 Nov 2019, 13:48 last edited by stvokr
    #1

    Hi all,

    I want to use a msi file in my qt installer.

    I added a script to the "installscript.qs". Content of the installscript.qs:

    function Component()
    {
        // default constructor
    }
    
    Component.prototype.createOperations = function()
    {
        // call default implementation
        component.createOperations();
    
        var msiPackage = "@TargetDir@\\setup\\msiPackage.msi";
    
        // install msi package
        component.addOperation( "Execute", "msiexec", [ "/i", msiPackage, "/passive" ], "UNDOEXECUTE", "msiexec", [ "/x", msiPackage, "/passive" ] );
    }
    

    The path for the msi file is:

    C:\Program Files\MyCompany\MyApplication\setup\msiPackage.msi"
    

    Unfortunately, the path contains spaces.
    What I don't understand is, that it works when the msi package is installed by the qt installer (even with spaces), but uninstall does not work because of the following error:

    Execution failed (Unexpected exit code: 1619): "msiexec /x C:\Program Files\MyCompany\MyApplication\setup\msiPackage.msi /passive"
    

    It is working (both install and uninstall) when the path does not contain any spaces.

    Even settings the path of the msiPackage into quotes does not work.

    var msiPackage = "\"@TargetDir@\\setup\\msiPackage.msi\"";
    

    Can someone help me?

    regards
    Oliver

    J 1 Reply Last reply 25 Nov 2019, 14:10
    0
    • S stvokr
      25 Nov 2019, 13:48

      Hi all,

      I want to use a msi file in my qt installer.

      I added a script to the "installscript.qs". Content of the installscript.qs:

      function Component()
      {
          // default constructor
      }
      
      Component.prototype.createOperations = function()
      {
          // call default implementation
          component.createOperations();
      
          var msiPackage = "@TargetDir@\\setup\\msiPackage.msi";
      
          // install msi package
          component.addOperation( "Execute", "msiexec", [ "/i", msiPackage, "/passive" ], "UNDOEXECUTE", "msiexec", [ "/x", msiPackage, "/passive" ] );
      }
      

      The path for the msi file is:

      C:\Program Files\MyCompany\MyApplication\setup\msiPackage.msi"
      

      Unfortunately, the path contains spaces.
      What I don't understand is, that it works when the msi package is installed by the qt installer (even with spaces), but uninstall does not work because of the following error:

      Execution failed (Unexpected exit code: 1619): "msiexec /x C:\Program Files\MyCompany\MyApplication\setup\msiPackage.msi /passive"
      

      It is working (both install and uninstall) when the path does not contain any spaces.

      Even settings the path of the msiPackage into quotes does not work.

      var msiPackage = "\"@TargetDir@\\setup\\msiPackage.msi\"";
      

      Can someone help me?

      regards
      Oliver

      J Offline
      J Offline
      JonB
      wrote on 25 Nov 2019, 14:10 last edited by JonB
      #2

      @stvokr
      In principle you need to quote the path with spaces by the time it gets executed as an OS command. I don't use this stuff, but there seems to be a discrepancy in your code:

      component.addOperation( "Execute", "msiexec", [ "/i", msiPackage, "/passive" ], "UNDOEXECUTE", [ "msiexec", "/x", msiPackage, "/passive" ] );
      

      In the first half, the misiexec is outside of the [ ... ] list. In the second half the misiexec is inside of the [ ... ] list. Why is this? Is there any relation to the command-line then generated?

      Further, you say the uninstall does not work and the message shows the install line (/i instead of /x). Is that an issue?

      S 1 Reply Last reply 25 Nov 2019, 14:25
      0
      • J JonB
        25 Nov 2019, 14:10

        @stvokr
        In principle you need to quote the path with spaces by the time it gets executed as an OS command. I don't use this stuff, but there seems to be a discrepancy in your code:

        component.addOperation( "Execute", "msiexec", [ "/i", msiPackage, "/passive" ], "UNDOEXECUTE", [ "msiexec", "/x", msiPackage, "/passive" ] );
        

        In the first half, the misiexec is outside of the [ ... ] list. In the second half the misiexec is inside of the [ ... ] list. Why is this? Is there any relation to the command-line then generated?

        Further, you say the uninstall does not work and the message shows the install line (/i instead of /x). Is that an issue?

        S Offline
        S Offline
        stvokr
        wrote on 25 Nov 2019, 14:25 last edited by stvokr
        #3

        @JonB

        1. This is in error, the paranthesis is wrong.

        2. This is also an error, a stupid typing error.

        I changed the first post.

        J 1 Reply Last reply 25 Nov 2019, 14:34
        0
        • S stvokr
          25 Nov 2019, 14:25

          @JonB

          1. This is in error, the paranthesis is wrong.

          2. This is also an error, a stupid typing error.

          I changed the first post.

          J Offline
          J Offline
          JonB
          wrote on 25 Nov 2019, 14:34 last edited by JonB
          #4

          @stvokr
          Then I'm afraid I don't know. I would have thought you need to quote the path as you showed in your attempt. Really this would apply to any command, nothing special about msiexec. Are you sure this does not work?

          Otherwise, the last example on https://doc.qt.io/qtinstallerframework/scripting.html uses @TargetDir@ and claims to work for C:\Program Files without quoting. And https://doc.qt.io/qtinstallerframework/operations.html example:

          Example: component.addOperation("Execute", "touch", "test.txt", "UNDOEXECUTE", "rm", "test.txt")
          

          does not use your [ ... ] syntax, and you have just the maximum 10 arguments to still fit.

          1 Reply Last reply
          0
          • S Offline
            S Offline
            stvokr
            wrote on 25 Nov 2019, 15:46 last edited by stvokr
            #5

            I have a solution, but I don't know if this is the best solution.

            You can uninstall a msi package with the productcode, in this case it is

            component.addOperation( "Execute", "msiexec", [ "/i", msiPackage, "/passive" ], "UNDOEXECUTE", "msiexec", [ "/x", "{0F1B057A-20E6-4D53-A523-B32B2B1B8987}", "/passive" ] );
            

            But I don't know windows product codes. Are they unique so you can use this number on any computer?

            J 1 Reply Last reply 25 Nov 2019, 16:06
            0
            • S stvokr
              25 Nov 2019, 15:46

              I have a solution, but I don't know if this is the best solution.

              You can uninstall a msi package with the productcode, in this case it is

              component.addOperation( "Execute", "msiexec", [ "/i", msiPackage, "/passive" ], "UNDOEXECUTE", "msiexec", [ "/x", "{0F1B057A-20E6-4D53-A523-B32B2B1B8987}", "/passive" ] );
              

              But I don't know windows product codes. Are they unique so you can use this number on any computer?

              J Offline
              J Offline
              JonB
              wrote on 25 Nov 2019, 16:06 last edited by
              #6

              @stvokr
              I think the product code is specified in the original msiexec package you installed, i.e. it's a resource in the .msi file. Then it may or may not change as new versions of that .msi are produced.

              1 Reply Last reply
              0
              • W Offline
                W Offline
                Womps
                wrote on 17 May 2021, 18:06 last edited by Womps
                #7

                I'm sorry to resurrect this old topic, but, is there any solution to the problem, other than specifying the product UUID ? I'm facing the exact same problem, using Qt Installer Framework 4.0.0

                If I write the following line, I get a 1619 error code during the installation (because of the white space in the Target Dir, I guess...) :

                component.addOperation("Execute", "msiexec", ["/i", "@TargetDir@\\apackagefile.msi"], "UNDOEXECUTE", "msiexec", ["/x", "@TargetDir@\\apackagefile.msi"])
                

                The package installation error popup says :
                "Execution failed (error code 1619) : "msiexec /i C:\Program Files\Something\apackagefile.msi"

                And If I try to avoid problems with spaces, as following :

                component.addOperation("Execute", "msiexec", ["/i", "\\"@TargetDir@\\apackagefile.msi\\""], "UNDOEXECUTE", "msiexec", ["/x", "\\"@TargetDir@\\apackagefile.msi\\""])
                

                I get a 1639 error code during the installation.
                The package installation error popup says :
                "Execution failed (error code 1639) : "msiexec /i "C:\Program Files\Something\apackagefile.msi""

                In this installer, I'm installing another dependency which is an exe file, and it works well.

                P.S : I forgot to say, I tried without arrays in my component.addOperation parameters, but I get the same errors

                J 1 Reply Last reply 5 Dec 2023, 10:02
                0
                • W Womps
                  17 May 2021, 18:06

                  I'm sorry to resurrect this old topic, but, is there any solution to the problem, other than specifying the product UUID ? I'm facing the exact same problem, using Qt Installer Framework 4.0.0

                  If I write the following line, I get a 1619 error code during the installation (because of the white space in the Target Dir, I guess...) :

                  component.addOperation("Execute", "msiexec", ["/i", "@TargetDir@\\apackagefile.msi"], "UNDOEXECUTE", "msiexec", ["/x", "@TargetDir@\\apackagefile.msi"])
                  

                  The package installation error popup says :
                  "Execution failed (error code 1619) : "msiexec /i C:\Program Files\Something\apackagefile.msi"

                  And If I try to avoid problems with spaces, as following :

                  component.addOperation("Execute", "msiexec", ["/i", "\\"@TargetDir@\\apackagefile.msi\\""], "UNDOEXECUTE", "msiexec", ["/x", "\\"@TargetDir@\\apackagefile.msi\\""])
                  

                  I get a 1639 error code during the installation.
                  The package installation error popup says :
                  "Execution failed (error code 1639) : "msiexec /i "C:\Program Files\Something\apackagefile.msi""

                  In this installer, I'm installing another dependency which is an exe file, and it works well.

                  P.S : I forgot to say, I tried without arrays in my component.addOperation parameters, but I get the same errors

                  J Offline
                  J Offline
                  jimitest
                  wrote on 5 Dec 2023, 10:02 last edited by jimitest 12 May 2023, 10:04
                  #8

                  @Womps
                  var msiPackage = "@TargetDir@\bin\UsbDk_1.0.22_x64.msi";
                  component.addOperation( "Execute", "msiexec", [ "/i", msiPackage, "/passive" ], "UNDOEXECUTE", "msiexec", [ "/x", msiPackage, "/passive" ] );

                  msiexec /i C:/Users/xxxxx/xxxxxx\bin\UsbDk_1.0.22_x64.msi /passive”

                  执行失败(意外退出代码:1619)

                  J 1 Reply Last reply 5 Dec 2023, 10:43
                  0
                  • J jimitest
                    5 Dec 2023, 10:02

                    @Womps
                    var msiPackage = "@TargetDir@\bin\UsbDk_1.0.22_x64.msi";
                    component.addOperation( "Execute", "msiexec", [ "/i", msiPackage, "/passive" ], "UNDOEXECUTE", "msiexec", [ "/x", msiPackage, "/passive" ] );

                    msiexec /i C:/Users/xxxxx/xxxxxx\bin\UsbDk_1.0.22_x64.msi /passive”

                    执行失败(意外退出代码:1619)

                    J Offline
                    J Offline
                    JonB
                    wrote on 5 Dec 2023, 10:43 last edited by
                    #9

                    @jimitest This is an English forum, people won't know what the error message in Chinese states?

                    1 Reply Last reply
                    0

                    • Login

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • Users
                    • Groups
                    • Search
                    • Get Qt Extensions
                    • Unsolved