Rodolfo Neuber
Rodolfo Neuber

Reputation: 3481

How do I implement support for /Layout on a custom wix burn ba (bootstrapper aplication)?

I have written a custom BA for a server application that has a rather complicated installer. At this point, the custom BA works well when downloading remote payloads. However, one of my favorite features of wix burn was its ability to support "offline" installs via the /layout command line option.

The moment I created a custom bootsrapper, the /layout option broke and doesn't do anything for me. So I realized that I must also implement the /layout functionality for my custom BA, but I can't seem to find any good resources on how to do this. I have tried looking through the WiX source code but its a little confusing to follow.

Has anyone done this before? Here is my first crack at it, but no luck. Any help would be greatly appreciated, thank you!

public class CustomBootstrapperApplication : BootstrapperApplication
{
    protected override void Run()
    {
        // other bootstrapper actions...

        if (Command.Action == LaunchAction.Layout)
        {
            // grab the layout directory
            string layoutDirectory = Command.LayoutDirectory;

            // is this how you perform the layout? 
            // currently the BA is asynchronous
            Engine.Plan(LaunchAction.Layout);
            Engine.Apply(IntPtr.Zero);
            Engine.Quit(0);

            // it doesn't seem to do anything. 
            // do I need to subscribe to some event?
            // what about using this thing? 
            string packageId = "sompackageid";
            string payloadId = "somepayloadid";
            string path = Path.Combine(layoutDirectory, packageId);
            Engine.SetLocalSource(packageId, payloadId, path);
        }
    }
}

Upvotes: 0

Views: 603

Answers (1)

Bob Arnson
Bob Arnson

Reputation: 21896

The WiX BA shows one approach: https://github.com/wixtoolset/wix3/tree/develop/src/Setup/WixBA

Upvotes: 0

Related Questions