0

Is it possible to make a silent install without the "/q" parameter via a condition within the WiX Setup?

I have a UIRef and a silent property with the value of 1 and now I want to install silent if this property is 1.

Stein Åsmul
  • 39,960
  • 25
  • 91
  • 164
sirzento
  • 537
  • 1
  • 5
  • 23

1 Answers1

0

WiX GUI: Never seen this to be honest, and I wouldn't recommend it. Some MSI files have no GUI in them at all, and then they install without any GUI - obviously. I suppose that is one option that is unacceptable.

Condition: I had a quick look, and conditioning the WelcomeDlg entry in InstallUISequence might work, though I find it a very odd design:

  1. Use Orca and add this condition to the WelcomeDlg: (NOT Installed OR PATCH) AND (NOT SILENT=1)
  2. Also add an entry to the Property table; SILENT=0 to avoid silent being the default run mode

Now you can try double clicking the MSI and you will see dialogs. If you use the below command line there should be no dialogs, but you will see a progress bar and you will get the UAC elevation prompt:

msiexec.exe /i MySetup.msi SILENT=1

WiX Snippet: Here is the markup you can try to use. No guarantees! :-). I can replace with a full "small runnable" sample if requested - the below is just what you can "slipstream" into a working setup. You also need to change the maintenance mode / uninstall dialogs if you want uninstall, modify and repair to be silent. Making modify silent sort of does not make sense.

Please remember that the markup is a "hack" and has not been fully tested in all installation modes: install, modify, repair, self-repair, patch, resume suspended, uninstall, major upgrade uninstall, etc... - please test accordingly - there are always surprises:

<..>

<Property Id="SILENT" Value="0" />
<UIRef Id="WixUI_Mondo" />

<..>

<InstallUISequence>
  <Show Dialog="WelcomeDlg" After="ResumeDlg">(NOT Installed OR PATCH) AND (NOT SILENT=1)</Show>
  <Show Dialog="ExitDialog" OnExit="success">(NOT SILENT=1)</Show>
</InstallUISequence>

<..>

Note! Constructs like these tend to backfire in real life. Suddenly you see a problem you never expected in some obscure installation mode (suspended resume, patch, modify or similar). If you want to use this, make sure you test well.

Note that there are other dialogs - such as modify and repair (maintenance mode dialogs) - that will still show up. You have to condition them as well if you want them to behave differently (and perhaps persist the SILENT property to determine i if you want to suppress dialogs or not).

Stein Åsmul
  • 39,960
  • 25
  • 91
  • 164
  • Where do I need to add this condition? For the WelcomeDlg I only have two publish Elements with the 'next' Control with a condition but not the whole Dialog. – sirzento Jun 03 '19 at 12:02
  • Do you have `Orca`? I am heading out the door, but you can get it [as explained here](https://stackoverflow.com/a/29937569/129130) (yellow section, a bit down the page). Open `MSI` in `Orca` and go to `InstallUISequence` and change the `Condition` column for `WelcomeDlg`. – Stein Åsmul Jun 03 '19 at 12:11
  • But where do I change it in the source Code and not after the .msi is build? Orca is just to edit the .msi right? – sirzento Jun 03 '19 at 12:55
  • I added some markup to the original answer. I didn't have the time before. I haven't really tested it, so give it a go please. Sure you need this feature? It is a bit strange **`:-)`**. – Stein Åsmul Jun 03 '19 at 15:08
  • Thanks, that works. And yes, thats what I need. Do you now how the show element would look like when I also dont want the last Dialog after installing where you have to press 'finish' ? – sirzento Jun 04 '19 at 11:48
  • 1
    Quickly added further markup, please test well. I just did a smoke test. The above should show an error message if the installation failed, but no dialog if the setup succeeded. – Stein Åsmul Jun 04 '19 at 12:11
  • Thanks, and thats ok if a Dialog is shown if an error comes or on uninstall etc. :) – sirzento Jun 04 '19 at 12:15
  • Great, good luck with the solution. These things tend to cause unexpected problems, but let's roll with it and see :-). – Stein Åsmul Jun 04 '19 at 12:30