Important: Please read the Qt Code of Conduct -

Using msi files in Qt Framework Installer

  • 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
        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?


  • @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?

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

  • @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 uses @TargetDir@ and claims to work for C:\Program Files without quoting. And 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.

  • 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?

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

  • 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

Log in to reply