0
votes

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.

1

1 Answers

0
votes

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.