[wix-users] Install selective features in WiX
earlej at hotmail.com
Tue Feb 27 11:27:04 PST 2018
Note that, I used the WixWPF project framework to help me get the basic installer up. The sample code in the wix src is much the same, more involved, but is gpl, may not be able to use it.
You need to:
a) define a structure to hold the current package and feature installation state:
private Dictionary<string, Wix.FeatureState> _featureStates = new Dictionary<string, Wix.FeatureState> ();
b) Handle DetectMsiFeature event:
public override void OnDetectMsiFeature(WPFBootstrapperEventArgs<Wix.DetectMsiFeatureEventArgs> args)
_featureStates[args.Arguments.FeatureId] = args.Arguments.State;
That gets called for each detected feature in your package.
c) Use _featureStates to update your GUI - toggle checkboxes, etc.
User can now play - choose what he wants installed, prior to clicking Modify.
d) Handle PlanMsiFeature event, called for each feature in your package, and adjust args.Arguments.State to either Local or Absent, depending on the GUI state... I also update _featureStates as well, at the same time.
Should do it, in a nutshell.
From: wix-users <wix-users-bounces at lists.wixtoolset.org> on behalf of Ven H via wix-users <wix-users at lists.wixtoolset.org>
Sent: Monday, February 12, 2018 5:01 AM
To: WiX Toolset Users Mailing List
Cc: Ven H
Subject: [wix-users] Install selective features in WiX
I have an MSI with 2 features nested inside a parent feature. It has a
default UI. During the first installation, I chose to install the first
feature only and not the second feature. So, the first feature gets
installed properly. Then when I click on the MSI and install again, from
the Change option, I chose to install the second feature only. But this
uninstalls the first one and installs the second. What I expected was it
will retain the first feature and install the second feature, but that
doesn't seem to the case.
In another case, I tried with custom UI for the features with check boxes.
Here, when I selected one feature and install it, it gets installed, but
when I ran the installer again and chose the second feature, only the first
feature is installed, but the second feature doesn't get installed.
Can anyone please help?
WiX Toolset Users Mailing List provided by FireGiant http://www.firegiant.com/
More information about the wix-users