【问题标题】:Wix toolset msi does not install other installers from powershell scriptWix 工具集 msi 不会从 powershell 脚本安装其他安装程序
【发布时间】:2020-06-16 01:18:37
【问题描述】:

我正在使用 wix 工具集创建一个 MSI 安装程序。

我的 MSI 将在自定义操作中运行 powershell 脚本。 然后,powershell 脚本(MYSCRIPT.ps1)将为依赖项执行安装程序。让我们将此依赖项命名为 D。

当我运行我的 powershell 脚本时,D 会完美地安装在我的系统中。

但是

当我运行从 wix 创建的 MSI 时,powershell 脚本运行但它无法安装 D。 为什么会这样。

我怀疑 Windows 不允许同时运行多个安装程序(我从 wix 生成的 MSI 和从 powershell 脚本执行的 D 安装程序)。

如何避免。

以下是我的 product.wxs 文件的一部分

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

安装D的powershell脚本中的代码是

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

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

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

提前感谢您的帮助

【问题讨论】:

    标签: wix windows-installer wix3.5 wix3


    【解决方案1】:

    我认为此时您应该重新评估如何安装相关应用程序。为避免此类头痛,您是否考虑过使用 WiX Bootstrapper?

    WiX Bootstrapper 允许您嵌入/下载和安装相关应用程序,以及处理升级等。

    【讨论】:

      【解决方案2】:

      如果我们在异步模式下运行自定义操作,我们只能从 wix 工具集中的自定义操作安装其他安装程序。

      所以换行有效。

      <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" />
      

      <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" />
      
      猜你喜欢
      • 1970-01-01
      • 2012-12-12
      • 2018-10-16
      • 2011-01-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多