Set UILevel property in CustomActionData, enter: /UILevel="[UILevel]"


A msi package can be started with different user interface types. For instance, a *.msi package started with msiexec /quit /i Example.msi, will have an UILevel = 2, but the same *.msi package started with msiexec /i Example.msi will have an UILevel = 5, see

User interface level Value Description
msiUILevelNoChange 0 Does not change UI level.
msiUILevelDefault 1 Uses default UI level.
msiUILevelNone 2 Silent installation.
msiUILevelBasic 3 Simple progress and error handling.
msiUILevelReduced 4 Authored UI and wizard dialog boxes suppressed.
msiUILevelFull 5 Authored UI with wizards, progress, and errors.
msiUILevelHideCancel 32 If combined with the msiUILevelBasic value, the installer shows progress dialog boxes but does not display a Cancel button on the dialog box to prevent users from canceling the installation.
msiUILevelProgressOnly 64 If combined with the msiUILevelBasic value, the installer displays progress dialog boxes but does not display any modal dialog boxes or error dialog boxes.
msiUILevelEndDialog 128 If combined with any above value, the installer displays a modal dialog box at the end of a successful installation or if there has been an error. No dialog box is displayed if the user cancels.

If you want to detect de UILevel of you’re executed msi package, during the execution of the msi package in a custom action follow the steps:

  • At a System.Configuration.Install.Installer to you’re project
  • image
  • Make sure the System.Configuration.Install.Installer has the attribute [RunInstaller(true)] set
  • Make sure the System.Configuration.Install.Installer has event handling wired up for the events you whish to handle (in this case I want to run code “AfterInstall” and “BeforeUninstall”
  • image
  • At a setup project to you’re solution
  • At the output and content files of you’re project to the setup project
  • image
  • Add custom actions (so the System.Configuration.Install.Installer events are fired)
  • image
  • image
  • Click on the custom actions and set the UILevel to /UILevel="[UILevel]" in the CustomActionData on the property page
  • image
  • In you’re “AfterInstall” event handler you can know access user interface type of the executed msi package, via this.Context.Parameters[“UILevel”]
  • Msi parameters are case sensitive so use “UILevel”
  • private void AfterInstallation(object sender, InstallEventArgs e)
    #if DEBUG
                // Break when in debug modus
                string uiLevel = this.Context.Parameters["UILevel"];

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.