Wix Bootstrapper with large package

2019-08-17 12:11发布

问题:

I am using Wix Toolset 3.11 and am attempting to create a Wix bootstrapper that is installing a very large prerequisite to my software - a legacy InstallShield executable with ~5000 associated files found in ~600 folders. I have compressed all these files into a single self-extracting archive that is approximately 3GB. I am getting the following error when attempting to build:

light.exe(0,0): error LGHT0001: Arithmetic operation resulted in an overflow.

Here is my current relevant XML in the bootstrapper:

<Chain>
   <PackageGroupRef Id="MyPrerequisites"/>
   <PackageGroupRef Id="ReallyBigExe"/>
   <PackageGroupRef Id="OtherStuff"/>
</Chain>
<Fragment>
   <util:RegistrySearch Id=ReallyBigExeFound" Key="Assume searching stuff is here"/>
   <PackageGroup Id=ReallyBigExe">
      <ExePackage InstallCondition="ReallyBigExeFound"
                  Compressed="no" 
                  DisplayName="Install Really Big Thing"
                  Permanent="no"
                  SourceFile="Packages\ReallyBigThing.exe"
                  Name="ReallyBigThing.exe"/>
   </PackageGroup>
</Fragment>

I've tried different variants of compressed, cached, name, etc and all result in the same error. I'm aware that this is due to the large file size of the included exe; see the Github Issue here.

I've also seen that detached containers are supposed to help with this issue. I have tried several combinations of using the container with my PackageGroup, also to no avail.

So, the question: How do I include this really big exe package with my installer in a way that lets me install it in the package chain, but does not embed it in the bootstrap data files?

回答1:

My resolution to the problem:

We did not want to track the files of the external "ReallyBigExe" as it is supposed to be a standalone product. Rather than packing the 5k files into a payload in the installer, I created a utility that allows executing an arbitrary executable:

static int Main(string[] args)
{
  // Check your arguments here

  string path = args[0];
  string executable = args[1];
  path = Path.GetDirectoryName(path);
  path = Path.Combine(path, executable);

  try
  {
    if(!File.Exists(path)) throw new FileNotFoundException();
    Process p = new Process()
    {
      StartInfo = new ProcessStartInfo(path)
    };
    p.Start();
    p.WaitForExit();
  }
  catch(Exception)
  {
    return -1;
  }
  return 0;
}

I launch this exe as part of the install process with arguments to the external executable I want to install:

<ExePackage SourceFile="$(var.MyUtility.TargetDir)MyUtility.exe"
            Compressed="yes">
  <CommandLine InstallArgument="[WixBundleOriginalSource] Data\setup.exe"/>
</ExePackage>

My external installer MUST be located in .\Data\ relative to the actual bootstrapper exe, but the arguments may be modified to point to any path. This can also be done through a Custom Action in most cases; in my case the external exe was installing SQL Server which would hang when the installation was launched through a Custom Action.



标签: wix burn wix3.11