3

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" />
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Ian Panzica
  • 334
  • 1
  • 6
  • 20
  • Possibly related: I had a problem that the installer did not continue after a restart. Using ViX 3.9 instead of 3.7 fixed the problem. – Peter Mortensen Oct 25 '17 at 03:26

1 Answers1

4

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"/>
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Tom Blodget
  • 20,260
  • 3
  • 39
  • 72
  • The problem now seems to be that those codes always seem to return even if the restart has occured and .net should already be installed. I just want the bootstrapper to skip over installing .net if it's already there which is what the detect and install conditions are supposed to do but they don't seem to be working or something else is going on. The installer is just in an endless loop of needing restarts. – Ian Panzica Jun 20 '13 at 17:41
  • Also! It seems to work fine when .net 4.5 is already installed on a system (ie it skips over .net installation and does the rest)...this doesn't seem to make sense to me seeing as after the restart, .net is installed so the loop shouldn't keep happening while it is installing. – Ian Panzica Jun 20 '13 at 17:49
  • 1
    I think I fixed it! I added: and it seems to work so thank you!! – Ian Panzica Jun 20 '13 at 18:13
  • do you have any idea why as it runs, it installs the other .exe (other than .net) and then tries to repair them in the same installation? Right now it runs through, restarts, then installs the others (presumably) then tries to repair them. If I hit cancel for each then the setup fails but everything is installed. I would assume that if I hit repair for each that setup is ok, and it will want to restart again like above. I have noticed that if I install .net, uninstall it, and run the installer again then everything installs no problems with no need for a restart. – Ian Panzica Jun 20 '13 at 19:33
  • The Burn logs might help you. Find them at WinKey+R %TEMP%. There'll be one for the bootstrapper and one for each package it attempts to run. – Tom Blodget Jun 20 '13 at 19:47
  • So what seems to be happening, is the .net installer runs, and then the bootstrapper accepts the restart. After the restart, the .net installer attempts to run again but sees that it is already installed so it tries to repair. Each of the other installers now run one by one, then try to repair one by one. If any of these actions fail, the whole installer reports failure which is undesirable. I just can't quite figure out why they try to repair. – Ian Panzica Jun 20 '13 at 20:28
  • Many installers repair when they are run while already installed. Add a `DetectCondition` attribute to your `ExePackage`s. Hopefully, the documentation for the package will tell you how to detect installation. – Tom Blodget Jun 21 '13 at 17:48