spaul@data.com.au
Posts: 5
Joined: Wed Jul 04, 2018 5:01 am

Supress MessageBox.Show during slent or passive installation

I have a good number of custom Actions and it seems even during a silent or passive installation via cmdline(/quiet /qn /passive), the message boxes are still popped up.

How do I suppress it ?

e.g. MessageBox.Show(string.Format("Installation error: {0} [{1}]\n{2}", e.Message, e.GetType().ToString(), e.StackTrace));

msiexec.exe /i RM.msi /quiet /l*v 1.log
Catalin
Posts: 6585
Joined: Wed Jun 13, 2018 7:49 am

Re: Supress MessageBox.Show during slent or passive installation

Hello,
How do I suppress it ?
I think that a good way of suppressing the message boxes during a silent install would be to condition them. To do so, you can make use of the "UILevel" property. The installer sets the "UILevel" property to the level of the user interface. The internal UI is enabled and set by "MsiSetInternalUI". This property is set to one of the following:

- 2 --> completely silent install

- 3 --> simple progress and error handling

- 4 --> authored UI, wizard dialogs suppressed

- 5 --> full UI

In order to get the "UILevel" property value in a custom action, you can have a look on our "How to set an installer property using custom actions". After doing so, you can simply condition your message boxes to be spawned only during full UI installs. For instance, here is a little PowerShell script that spawns a message box only during full UI installations.

Code: Select all

Add-Type -AssemblyName PresentationFramework
$var = AI_GetMsiProperty UILevel
if($var -eq '5'){
[System.Windows.MessageBox]::Show($var)
}
Hope this helps.

Kind regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”