.net - 蜡烧伤 : How to reboot after installing a MsuPackage

标签 .net wix windows-installer burn

我目前有一个场景,我需要使用 burn 执行以下操作

  1. 安装 Windows 成像组件
  2. 安装 Windows Installer 4.5
  3. 安装 .Net 4 Web
  4. 运行我的安装程序(使用 Wix 3.6 创建)

我想知道是否有办法在安装 MsuPackage 后强制重新启动...

在我的场景中,当 Bootstrap 在 Windows Vista 上安装 Windows6.0-KB942288-v2-x86.msu 并随后尝试在不重新启动的情况下安装 .Net Framework 时,会抛出错误:0x8007064d - 此安装包无法安装Windows 安装程序服务...

如果我在错误后重新启动并再次运行安装程序,它就会正常工作。请注意,使用 ExePackage 可以指定 InstallCommand 以及 ExitCode,如何在 MsuPackage 中实现相同的行为?

请参阅下面我的 wxs 文件的内容:

<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" 
     xmlns:bal="http://schemas.microsoft.com/wix/BalExtension" 
     xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
  <Bundle Name="$(var.MyProject.ProjectName)" Version="2.6.0.0" Manufacturer="Awesome Software (Pty) Ltd" UpgradeCode="6a77118d-c132-4454-850b-935edc287945">
    <BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.RtfLicense">
      <bal:WixStandardBootstrapperApplication
        LicenseFile="$(var.SolutionDir)Awesome.EULA\Awesome CE Eula.rtf"
        SuppressOptionsUI="yes"/>
    </BootstrapperApplicationRef>

    <util:FileSearch Path="[SystemFolder]\windowscodecs.dll" Variable="windowscodecs" Result="exists" />

    <Chain>
      <!-- Windows Imaging Component-->
      <ExePackage Cache="no" Compressed="no" PerMachine="yes" Permanent="yes" Vital="yes"
        SourceFile="redist\wic_x86_enu.exe"
        DownloadUrl="http://download.microsoft.com/download/f/f/1/ff178bb1-da91-48ed-89e5-478a99387d4f/wic_x86_enu.exe"
        InstallCondition="VersionNT &lt; v5.2 AND NOT VersionNT64"
        DetectCondition="windowscodecs"
        InstallCommand="/quiet /norestart">
      </ExePackage>
      <ExePackage Cache="no" Compressed="no" PerMachine="yes" Permanent="yes" Vital="yes"
        SourceFile="redist\wic_x64_enu.exe"
        DownloadUrl="http://download.microsoft.com/download/6/4/5/645FED5F-A6E7-44D9-9D10-FE83348796B0/wic_x64_enu.exe"
        InstallCondition="VersionNT &lt; v5.2 AND VersionNT64"
        DetectCondition="windowscodecs"
        InstallCommand="/quiet /norestart">
      </ExePackage>
      <!-- Windows Installer 4.5 -->
      <ExePackage Cache="no" Compressed="no" PerMachine="yes" Permanent="yes" Vital="yes"
          SourceFile="redist\WindowsXP-KB942288-v3-x86.exe"
          DownloadUrl="http://download.microsoft.com/download/2/6/1/261fca42-22c0-4f91-9451-0e0f2e08356d/WindowsXP-KB942288-v3-x86.exe"
          InstallCondition="VersionNT=v5.1 AND NOT VersionNT64 AND VersionMsi &lt; v4.5"
          InstallCommand="/quiet /norestart">
        <ExitCode Behavior="forceReboot"/>
      </ExePackage>
      <ExePackage Cache="no" Compressed="no" PerMachine="yes" Permanent="yes" Vital="yes"
          SourceFile="redist\WindowsServer2003-KB942288-v4-x86.exe"
          DownloadUrl="http://download.microsoft.com/download/2/6/1/261fca42-22c0-4f91-9451-0e0f2e08356d/WindowsServer2003-KB942288-v4-x86.exe"
          InstallCondition="VersionNT=v5.2 AND NOT VersionNT64 AND VersionMsi &lt; v4.5"
          InstallCommand="/quiet /norestart">
        <ExitCode Behavior="forceReboot"/>
      </ExePackage>
      <ExePackage Cache="no" Compressed="no" PerMachine="yes" Permanent="yes" Vital="yes"
          SourceFile="redist\WindowsServer2003-KB942288-v4-x64.exe"
          DownloadUrl="http://download.microsoft.com/download/2/6/1/261fca42-22c0-4f91-9451-0e0f2e08356d/WindowsServer2003-KB942288-v4-x64.exe"
          InstallCondition="VersionNT=v5.2 AND VersionNT64 AND VersionMsi &lt; v4.5"
          InstallCommand="/quiet /norestart">
        <ExitCode Behavior="forceReboot"/>
      </ExePackage>
      <MsuPackage Cache="no" Compressed="no" Permanent="yes" Vital="yes" KB="KB942288" 
          SourceFile="redist\Windows6.0-KB942288-v2-x86.msu"
          DownloadUrl="http://download.microsoft.com/download/2/6/1/261fca42-22c0-4f91-9451-0e0f2e08356d/Windows6.0-KB942288-v2-x86.msu"
          InstallCondition="VersionNT=v6.0 AND NOT VersionNT64 AND VersionMsi &lt; v4.5">
      </MsuPackage>
      <MsuPackage Cache="no" Compressed="no" Permanent="yes" Vital="yes" KB="KB942288"
          SourceFile="redist\Windows6.0-KB942288-v2-x64.msu"
          DownloadUrl="http://download.microsoft.com/download/2/6/1/261fca42-22c0-4f91-9451-0e0f2e08356d/Windows6.0-KB942288-v2-x64.msu"
          InstallCondition="VersionNT=v6.0 AND VersionNT64 AND VersionMsi &lt; v4.5">
      </MsuPackage>
      <PackageGroupRef Id="NetFx40Web"/>
      <RollbackBoundary />
      <MsiPackage Id="MaxCut" SourceFile=".\StagingBundle\Awesome.msi" DisplayInternalUI="no"/>
    </Chain>
  </Bundle>
</Wix>

最佳答案

自动检测 MsuPackage 重新启动。您安装的 MSU 可能表示需要重新启动(日志文件应该说明一些内容,IIRC),但不需要强制重新启动。有人要求 Burn 有一种方法将链中的“需要重新启动”升级为“如果此时需要重新启动,则立即重新启动”。不幸的是,目前该功能尚不存在。

但是,您可以通过从 OnExecutePackageComplete() 回调返回 IDRESTART 在自定义 BootstrapperApplication 中实现“立即强制重启”行为。在有人实现该功能之前,这是唯一的选择。

关于.net - 蜡烧伤 : How to reboot after installing a MsuPackage,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15502480/

相关文章:

WiX/MSI : Redirect stdout to file, 类型 50 自定义操作

msbuild - 如何从 assemblyInfo.cs 读取程序集版本?

c# - 设置中的自定义类型

.net - "There was no endpoint listening at..."

.net - 如何在 where 子句中将 UserDefinedFunctionProvider.Invoke 与 udfs 结合使用

Outlook插件直接进入非事件应用程序插件

wix - 忽略不允许的属性 IISMAJORVERSION 和 'EnableUserControl' ?

.net - 样式指南/布局 web.config 和 app.config 以获得持续支持的最佳方式

wix - 我可以选择使用转换在 Wix Heat 中包含特定文件扩展名吗?

c# - 执行时安装文件后的 Wix 自定义操作 dll