1

Using WixSharp to build installer,

Is LaunchCondition shown when running in silent mode? (e.g "msiexec /i /qn /quiet")

R.P
  • 171
  • 1
  • 11

1 Answers1

1

MSI GUI: MSI has many UILevels - degrees of visible GUI (more on this here). When a setup is run in silent mode, any errors from Launch Conditions will show up in the MSI log instead of a dialog.

This makes sense since you must avoid dialogs showing up when there might be nobody to dismiss them (for example in automatic package deployment systems).

Essentially you can run with basic GUI /qb or reduced GUI /qr or completely silently /qn. When you run silently no dialogs should be shown, and you should consult the log file for results:

Silent MSI installation:

msiexec /i MySetup.msi /qn /L test.log

Test Project: https://github.com/glytzhkof/WiXLaunchConditionTest (MYVALUE is defined in the Property table - change it there to 0 or 1).

Here is a sample log output:

=== Logging started: 28.10.2021  13:07:12 ===
Action start 13:07:12: INSTALL.
Action start 13:07:12: FindRelatedProducts.
Action ended 13:07:12: FindRelatedProducts. Return value 1.
Action start 13:07:12: LaunchConditions.
MSI (s) (F4:DC) [13:07:12:491]: Product: WiXLaunchConditionTest -- Value for MYFLAG must be 1 (true) or 0 (false)

Value for MYFLAG must be 1 (true) or 0 (false)
Action ended 13:07:12: LaunchConditions. Return value 3.
Action ended 13:07:12: INSTALL. Return value 3.
MSI (s) (F4:DC) [13:07:12:493]: Product: WiXLaunchConditionTest -- Installation failed.

MSI (s) (F4:DC) [13:07:12:493]: Windows Installer installerte produktet. Produktnavn: WiXLaunchConditionTest. Produktversjon: 1.0.0.0. Produktspråk: 1033. Produsent: -. Installasjonens resultatstatus: 1603.

=== Logging stopped: 28.10.2021  13:07:12 ===

Admin Rights: It should be noted that an MSI should be run from a cmd.exe with admin rights - or you get no message from the silent installer that the setup failed because of lacking admin rights (the failure is from lacking admin rights, not because of the launch conditions).

This registry script adds context menus in Windows Explorer which can open a cmd.exe in any folder with or without admin rights: https://github.com/glytzhkof/all/blob/master/HKCU_Run-CMD-Shell-Extension.reg. Just merge the registry file and then right click an empty space inside Windows Explorer in any folder. See the commands towards the bottom of the dialog:

Windows Explorer Context Menu

Stein Åsmul
  • 39,960
  • 25
  • 91
  • 164
  • Thanks for your answer! I need the error message to be displayed in message box even in case the user run in silent mode ,Is it possible? – R.P Oct 28 '21 at 13:55
  • 1
    Yes, you can use a custom action to do this, but it is not good MSI design. When you run a setup completely silently it should "report findings" in the log file - this is by design of the technology and should be heeded. If you run the MSI with basic `/qb` or reduced GUI `/qr` (instead of completely silent `/qn`) there will be a dialog box showing up. – Stein Åsmul Oct 28 '21 at 17:00
  • MSI has many [UILevels](https://learn.microsoft.com/en-us/windows/win32/msi/uilevel) - **degrees of visible** GUI ([more on this here](https://stackoverflow.com/a/59796273/129130)). [Here is an answer on how this affects uninstall in unexpected ways](https://stackoverflow.com/a/29679464/129130). Be careful messing with this is my advice. MSI is a strange technology - it fights back when you do unexpected things. ([War stories](https://stackoverflow.com/a/45840087/129130) - terribly messy content that you might want to skim). – Stein Åsmul Oct 28 '21 at 17:08
  • I should add that your dialog could "show up" in distribution systems intended to install the MSI silently on potentially thousands of computers. This is how corporations do deployment. This would make the distribution hang as there is nobody there to dismiss the [modal dialog](https://en.wikipedia.org/wiki/Modal_window). A packaging team would remove your dialog custom action - if they see it in there, but they could also forget to do so making your setup malfunction in distribution. If you add this dialog, document it well. Don't add it :-). – Stein Åsmul Oct 28 '21 at 17:17
  • thank you, I voted your answer:) – R.P Oct 28 '21 at 19:43
  • btw- I just saw in your profile that you're a installer expert, so may you kbow to tell me if using MajorUpgrade roll back to the previous version that was installed in case of fail the upgrade? Thank you! – R.P Oct 28 '21 at 19:54
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/238671/discussion-between-stein-asmul-and-racheli-ganon). – Stein Åsmul Oct 28 '21 at 20:23