Wix how to hide feature options

2019-03-16 13:51发布

问题:

I'm using Wix 3.5 to build a MSI installer. I want to know if there is any way to hide some options from the "Features Custom Setup dialog" (in which you select from the Feature tree what to install).

I want to only have the options for "Will be installed on local hard drive" and "Entire feature will be unavailable"

Currently, apart from those two options i have these options:

  • "Entire feature will be installed on local hard drive"
  • "Will be installed to run from network"
  • "Entire feature will be installed to run from network"

回答1:

Feature selection dialog uses SelectionTree control, a built-in control of the Windows Installer.

You can control which installation options are displayed for a feature using Attributes column of the Feature Table.

Feature element of WiX has four properties which control how a feature can be installed:

  • Absent: allow / disallow
  • AllowAdvertise: no / system / yes
  • InstallDefault: followParent / local / source
  • TypicalDefault: advertise / install

Component table also controls whether the component can be run from source or not. The Component element has Location property:

  • local
    Prevents the component from running from the source or the network (this is the default behavior if this attribute is not set).
  • source
    Enforces that the component can only be run from the source (it cannot be run from the user's computer).
  • either
    Allows the component to run from source or locally.

So to remove the option to run from the network, set Location property of your components to local.

You cannot remove Entire feature will be installed on local hard drive from the options. It is displayed only when there are subfeatures and enables installation of the subfeatures as well as the feature itself as opposed from Will be installed on local hard drive which installs only the selected features and does not affect subfeatures.

If the subfeatures are always installed with the parent, you can try to set InstallDefault attribute of the subfeatures to followParent.



回答2:

To remove "This feature will be installed when required" set in your feature AllowAdvertise="no" https://www.firegiant.com/wix/tutorial/user-interface/custom-settings/



回答3:

If you are using the WiX UIExtension, then you need to download the WiX source code for that extension and modify it appropriately. The following links should help get you started:

WiX UI Customizations

Wix custom UI for SQL Database installation

How to add a UI to a WiX 3 installer?

UPDATE:

Upon examining the WiX UI source, the FeaturesDlg displays a "SelectionTree" control. It appears that the control (along with the other controls displayed by the WiX UI) are Windows Installer controls, not WiX-specific controls. See SelectionTree. So it appears there is no easy way to just "turn off" those options.