Resume installing after restart in WiX

放肆的年华 提交于 2020-08-23 08:02:28

问题


I'm trying to create a bootstrap application using WixStandardBootstrapperApplication. It does everything I need it to do really well except handling a restart.

I need to install a group of EXE files. Only the first one is .NET 4.5 and that requires a restart. I would delay the restart, but I can't because one of the other programs is dependent on it. I've tried using an exit code to forcereboot, but when the computer starts back up the bootstrapper gets stuck at that exit code every time, and I can't install anything else. Is there a way to apply the exit code if and only if the program has not restarted yet (or any other logical way)?

Here's what I'm doing...

<ExePackage
  Id               = "NetFx45Redist"
  Cache            = "no"
  Compressed       = "yes"
  PerMachine       = "yes"
  Permanent        = "yes"
  Vital            = "yes"
  InstallCommand   = "/quiet /norestart"

  SourceFile       = "C:\Users\visibleEP\Documents\Visual Studio 2012\Projects\Bootstrapper1\VEP Deploy\Setup Files\dotNetFx45_Full_setup.exe"
  DetectCondition  = "(Netfx4FullVersion=&quot;4.5.50709&quot;) AND (NOT VersionNT64 OR (Netfx4x64FullVersion=&quot;4.5.50709&quot;))"
  InstallCondition = "(VersionNT >= v6.0 OR VersionNT64 >= v6.0) AND (NOT (Netfx4FullVersion=&quot;4.5.50709&quot; OR Netfx4x64FullVersion=&quot;4.5.50709&quot;))">

  <ExitCode Behavior = "forceReboot"/>
</ExePackage>

<ExePackage
  SourceFile = "...\...\Setup Files\Encoder_en.exe"
  InstallCommand = "/q"/>

<ExePackage
  SourceFile = "...\...\Setup Files\vcredist_x86.exe"
  InstallCommand = "/q /ACTION=Install"
  RepairCommand = "/q ACTION=Repair /hideconsole" />

<ExePackage
  SourceFile = "...\...\Setup Files\vcredist_x64.exe"
  InstallCommand = "/q /ACTION=Install"
  RepairCommand = "/q ACTION=Repair /hideconsole" />

回答1:


Replace

<ExitCode Behavior="forceReboot"/>

With

<ExitCode Behavior="forceReboot" Value="1641" />
<ExitCode Behavior="forceReboot" Value="3010" />

Both 1641 and 3010 are "A restart is required to complete the installation. This message indicates success."

Your version treats all exit codes as the same, which you observed. See the documentation on that installer. Fortunately, exit codes are documented.

UPDATE: I added known success codes and a catch-all which could be error if you are confident that all success codes are documented.

<ExitCode Behavior="success" Value="0" />
<ExitCode Behavior="error"/>


来源:https://stackoverflow.com/questions/17218785/resume-installing-after-restart-in-wix

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!