在自定义 Burn Bootstrapper 应用程序中执行 MSI 包
我在 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
其意义远不止于此:您必须要求引擎检测机器状态、规划包操作并应用它们。看一下 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.