How to extract Wix bootstrapper embedded msi before actually run install?

1.2k views Asked by At

I was able to use the System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName; and Ubinder to extract itself.

But in Wix 3.10.3 stable, BA just extracts a slim ba.exe to temp folder, and then it will switch to run the slim ba.exe which has no msi in it. Extracting itself will not work. While I still cannot get the first startup full ba.exe since it's already closed.

If there is any property I can get from BootstrapperApplication class to point out the full ba.exe (it should has some trace since the msi should be extracted when it starts to install) or can I invoke the extraction before it starts to install msi?

1

There are 1 answers

1
John M. Wright On BEST ANSWER

Using the Unbinder class, you can extract the embedded MSIs into a working folder. Note this only works if you're using embedded MSIs for your bundle.

I've included the code below, which requires you to provide the path to your bundle executable (which is different from the ba.exe). I've written up how I did this on my blog, which you can view here: https://www.wrightfully.com/extracting-wix-bundled-msi-files-without-running-the-installer/

    Unbinder unbinder = null;

    try
    {
        unbinder = new Unbinder();
        //unbinder.Message += MessageEventHandlerMethod;
        unbinder.Unbind(bundlePath, OutputType.Bundle, tmpFolder);
    }
    finally
    {
        if (null != unbinder)
            unbinder.DeleteTempFiles();
    }