Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Detect silent install in .NET Custom Action

How do you detect that the install is running in silent mode?

I have a custom application that I've added a .msi setup project. I run the .msi file with the /qb switch, and in my custom installer c# code I would like to be able to detect this.

Edit: nobugs says to test the UILevel property. How do I access the UILevel property from a class derived from the System.Configuration.Install.Installer class?

like image 919
aaaa bbbb Avatar asked Mar 05 '10 17:03

aaaa bbbb


1 Answers

Taking the hint from nobugz, I did the following:

  1. On the Custom Actions view of the .msi setup project, I added the following to my CustomActionData (to pass the UILevel through to my custom installer):

    /UILevel="[UILevel]"

  2. Within my C# code for the code derived from base class Installer, I added code to get the value:

    string uiLevelString = Context.Parameters["UILevel"];

  3. It was then simple to parse the string for an int value. If the value is <= 3, it is a silent install.

like image 52
aaaa bbbb Avatar answered Sep 29 '22 08:09

aaaa bbbb