简体   繁体   中英

WiX silent install condition via property

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.

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).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM