1

I have created a burn bootstrapper project which installs 3 MSI packages. If there is an error within any of the packages or any other errors occur as a result of which the installation fails then an error message should be displayed through my WPF app. How can I do this? Any example would be much appreciated.

AnOldSoul
  • 4,017
  • 12
  • 57
  • 118

1 Answers1

3

You'll need to subscribe to the (many) engine events. Most of these have EventArgs that derive from ResultStatusEventArgs. If the status isn't 0, something went wrong.

For example, a catch all at the end of installation:

    ...
    bootstrapper.ApplyComplete += OnApplyComplete;
    ...

    private void OnApplyComplete(object sender, ApplyCompleteEventArgs e)
    {
        // Deal with error here:
        if (e.Status != 0)
        {
            string error = new Win32Exception(e.Status).Message;
            ErrorMessage = $"Error installing: {error}. Code: 0x{e.Status:x8}";
        }
    }
intinit
  • 480
  • 4
  • 14