在自定义 Burn Bootstrapper 应用程序中执行 MSI 包

发布于 2025-01-02 09:31:56 字数 858 浏览 1 评论 0原文

我在 Burn 中将 MSI 包与 .NET 4.0 框架安装程序捆绑在一起。由于我不喜欢 Burn 应用程序的用户界面,因此我编写了自己的自定义引导程序应用程序。如果尚未安装 .NET Framework,则已正确安装。但我不知道如何安装 MSI 包。这是我的自定义 BA 的代码,我已检查它是否已执行。

public class ShopProtectBA : BootstrapperApplication
{
    protected override void Run()
    {

        //Here i would like to run the bundled MSI package.
        Engine.Quit(0);
    } 
}

这方面的文档很少。我不应该在 Run() 中安装该包吗?这个叮是如何工作的?

编辑:我忘了提及这是一个自定义托管引导程序应用程序。如果有什么区别的话。

我能想到的最好的办法是:

            var pl = new PlanMsiFeatureEventArgs("MyMsiPackage", "Complete", FeatureState.Local);
        Engine.Detect();
        OnPlanMsiFeature(pl);

        Engine.Plan(LaunchAction.Install);

        Engine.Elevate(FindWindow(null, "Setup"));
        Engine.Apply(FindWindow(null, "Setup"));

但它只会出现一个窗口,告诉我安装已准备就绪。然后我就关门了,什么也没发生。

I am bundling a MSI package with the .NET 4.0 framework installer in Burn. Since i do not like the userinterface Burn applies, i have written my own custom Bootstrapper Application. The .NET framework is installed correctly, if it is not already installed. But i can not figure out how to install the MSI package. This is the code i have for my custom BA, i have checked that it gets executed.

public class ShopProtectBA : BootstrapperApplication
{
    protected override void Run()
    {

        //Here i would like to run the bundled MSI package.
        Engine.Quit(0);
    } 
}

The documentation on this is sparse. Should i not install the package in Run() ? How do this ting work?

Edit: I forgot to mention that is is a custom Managed Bootstrapper Application. If it makes any difference.

The best i can come up with is this:

            var pl = new PlanMsiFeatureEventArgs("MyMsiPackage", "Complete", FeatureState.Local);
        Engine.Detect();
        OnPlanMsiFeature(pl);

        Engine.Plan(LaunchAction.Install);

        Engine.Elevate(FindWindow(null, "Setup"));
        Engine.Apply(FindWindow(null, "Setup"));

But it results only in a window telling me that the installation is prepared. Then i closes and nothing more happends.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

有木有妳兜一样 2025-01-09 09:31:56

其意义远不止于此:您必须要求引擎检测机器状态、规划包操作并应用它们。看一下 WiX BA 本身的源代码:src\Setup\WixBA。

There's more to it than that: You have to ask the engine to detect machine state, plan package actions, and apply them. Take a look at the source code for the WiX BA itself: src\Setup\WixBA.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文