簡體   English   中英

Wix 工具集 msi 不會從 powershell 腳本安裝其他安裝程序

[英]Wix toolset msi does not install other installers from powershell script

我正在使用 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 引導程序?

WiX 引導程序允許您嵌入/下載和安裝相關應用程序,以及處理升級等。

如果我們在異步模式下運行自定義操作,我們只能從 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" />

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM