简体   繁体   中英

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

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?

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();
    }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM