0
votes

I am creating an MSI installer using wix toolset.

My MSI will run a powershell script in a custom action. The powershell script(MYSCRIPT.ps1) will then execute a installer for a dependency. Lets name this dependency as D.

When I run my powershell script then D gets installed in my system perfectly.

But

When I run the MSI created from wix the powershell script runs but it fails to install D. Why is it so.

I suspect windows is not allowing multiple installers(my MSI generated from wix and installer for D executed from powershell script) to run at same time.

How can it be avoided.

Below is part of my product.wxs file

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">

    <?define Manufacturer="DWJIDWJDJ"?>

    <Product Id="*" Name="JDCA" Language="1033" Version="0.0.0.0" Manufacturer="$(var.Manufacturer)" UpgradeCode="dad416b3-034d-49eb-9407-0b681e5108c3">
        <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />

        <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
        <MediaTemplate EmbedCab="yes" />

        <Property Id="ARPNOREPAIR" Value="yes" Secure="yes" />
        <Property Id="ARPNOMODIFY" Value="yes" Secure="yes" />

        <Feature Id="ProductFeature" Title="WDJNIDJDJW" Level="1">
            <ComponentGroupRef Id="InstallScriptsGroup" />
            <ComponentGroupRef Id="ResourcesGroup" />
        </Feature>

        <CustomAction Id="ComponentsInstallAction" Property="WixShellExecTarget" Directory="INSTALLFOLDER" ExeCommand ='"$(env.SystemRoot)\system32\WindowsPowerShell\v1.0\powershell.exe" -ExecutionPolicy Bypass -NonInteractive -NoProfile -Command ./MYSCRIPT.ps1' Execute="deferred" Impersonate="no" Return="check" />

        <InstallExecuteSequence>
            <Custom Before="InstallFinalize" Action="ComponentsInstallAction">Not Installed or REINSTALL</Custom>
        </InstallExecuteSequence>

    </Product>

    <Fragment>
        <Directory Id="TARGETDIR" Name="SourceDir">
            <Directory Id="CommonAppDataFolder">
                <Directory Id="IhmDir" Name="IHM">
                    <Directory Id="INSTALLFOLDER" Name="IhmZebraComponents" />
                </Directory>
            </Directory>
        </Directory>

        <ComponentGroup  Id="InstallScriptsGroup"  Directory="INSTALLFOLDER">
            <Component Id="ComponentsInstallerScript" Guid="72cef904-4426-470d-a2d0-9545d0127f0a">
                <File Id="ComponentsInstallerSscript" Source="MYSCRIPT.ps1" KeyPath="yes" Checksum="yes"/>
            </Component>
        </ComponentGroup>

        <ComponentGroup  Id="ResourcesGroup"  Directory="INSTALLFOLDER">

CONTINUED

The code in powershell script which installs D is

$Argument = "-S -f1`"$InstallResponseFile`""

$InstallProcess = Start-Process -Wait -FilePath $SetupFile -Argument $Argument -PassThru

LogWrite("| INFO | Completed execution of $SetupFile")

Thanks in advance for any help

2

2 Answers

0
votes

I think at this point you should re-evalulate how you can install the dependent application. To avoid some head-aches like this, have you considered using the WiX Bootstrapper?

The WiX Bootstrapper allows you to embed/download and install dependent applications, as well as handling upgrades etc.

-1
votes

We can only install other installers from custom actions in wix toolset if we run the custom action in asynchronous mode.

So changing the line works.

<CustomAction Id="ComponentsInstallAction" Property="WixShellExecTarget" Directory="INSTALLFOLDER" ExeCommand ='"$(env.SystemRoot)\system32\WindowsPowerShell\v1.0\powershell.exe" -ExecutionPolicy Bypass -NonInteractive -NoProfile -Command ./MYSCRIPT.ps1' Execute="deferred" Impersonate="no" Return="check" />

to

<CustomAction Id="ComponentsInstallAction" Property="WixShellExecTarget" Directory="INSTALLFOLDER" ExeCommand ='"$(env.SystemRoot)\system32\WindowsPowerShell\v1.0\powershell.exe" -ExecutionPolicy Bypass -NonInteractive -NoProfile -Command ./MYSCRIPT.ps1' Execute="immediate" Impersonate="no" Return="asyncNoWait" />