如何在自定义wix burn ba(bootstrapper应用程序)上实现对/ Layout的支持?

时间:2014-04-09 14:49:13

标签: wix bootstrapper burn

我为服务器应用程序编写了一个自定义BA,它具有相当复杂的安装程序。此时,自定义BA在下载远程有效负载时运行良好。但是,我最喜欢的wix刻录功能之一是它能够通过/ layout命令行选项支持“离线”安装。

当我创建自定义的bootsrapper时,/ layout选项已经破坏,并且对我没有任何作用。所以我意识到我还必须为我的自定义BA实现/ layout功能,但我似乎无法在如何上找到任何好的资源。我试过通过WiX源代码查看,但它有点令人困惑。

以前有人这样做过吗?这是我的第一次破解,但没有运气。非常感谢任何帮助,谢谢!

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

1 个答案:

答案 0 :(得分:0)