3

I have a simple Burn bootstrapper in which the first thing I need to do is trigger a reboot (before anything is installed), then continue with the installation after reboot. I have set up the chain as such:

<Chain>
  <ExePackage SourceFile="DummyExe.exe">
    <ExitCode Behavior="forceReboot" />
  </ExePackage>
  <PackageGroupRef Id="NetFx40Web" />
  <PackageGroupRef Id="others..." />
</Chain>

This works fine when I run the installer initially: it forces a reboot and continues the installer upon login, but then the chain starts over again from the beginning, thus triggering another reboot. It just forces a reboot continuously and never continues installation.

I have found other answers that explain how to do this with a custom bootstrapper application, but I am currently using bal:WixStandardBootstrapperApplication.

Is this possible without writing a CBA? (I am using WiX 3.7)

Community
  • 1
  • 1
kcnygaard
  • 794
  • 7
  • 18

2 Answers2

2

You are getting exactly what you are asking for.

You want to provide a Value attribute in the ExitCode element to condition the Behavior. Without one, the behavior is invoked for any exit code. Consult the documentation of the package for expected exit codes and their meanings. You can specify multiple ExitCode elements if you wish, with a final element without a Value to specify a default Behavior.

Tom Blodget
  • 20,260
  • 3
  • 39
  • 72
  • Fortunately I am in control of the `ExePackage`. It is just a placeholder I added to force a restart before install. If I add multiple `ExitCode` elements, I guess I need to modify my dummy exe to return one exit code before restart, and another after restart (to signal we don't need to install)? I suppose writing a temporary reg key is the best way to do that. – kcnygaard Aug 27 '13 at 18:58
  • You probably should allow the exe to be run to no effect—0 might be a good exit code for that was well as for a completed install. If you do want to avoid running it at all when it will have no effect then you can specify a DetectCondition. – Tom Blodget Aug 27 '13 at 19:41
1

This could work:

<Chain>
  <ExePackage Id="DummyReboot" SourceFile="DummyExe.exe" InstallCondition="NOT WixBundleForcedRestartPackage = DummyReboot" >
    <ExitCode Behavior="forceReboot" />
  </ExePackage>
  <PackageGroupRef Id="NetFx40Web" />
  <PackageGroupRef Id="others..." />
</Chain>
Robert
  • 5,278
  • 43
  • 65
  • 115