title: How do I implement support for /Layout on a custom wix burn ba (bootstrapper aplication)?
body: <p>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.</p>
  
  <p>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 <em>how</em> to do this. I have tried looking through the WiX source code but its a little confusing to follow.</p>
  
  <p>Has anyone done this before? Here is my first crack at it, but no luck. Any help would be greatly appreciated, thank you!</p>
  
  <pre><code>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);
          }
      }
  }
  </code></pre>