I solved this same issue with a custom action on the next button of the
feature selection dialog. I tried solving it within Wix/Windows Installer
but was unable to.
The pseudo-code is something like this...
<Publish Dialog="CustomizeDlg" Control="Next" Event="DoAction"
Value="CAMustSelectOne" Order="1">1</Publish>
<Publish Dialog="CustomizeDlg" Control="Next" Event="NewDialog"
Value="VerifyReadyDlg" Order="2"><![CDATA[ATLEASTONESELECTED <>
"0"]]></Publish>
Custom Action looked something like this (error handling and exception
management removed for brevity):
// these are all hidden or "container only" features,
// if they are selected for install, they are not considered a "real"
feature
private static readonly string[] IgnoredFeatures = { "Server", "Logs",
"Data", "WebSites", "WindowsServices", "Tools" };
[CustomAction]
public static ActionResult MustSelectOne(Session session)
{
ActionResult installResult = ActionResult.Success;
// assume we success until told otherwise
session["ATLEASTONESELECTED"] = "1";
if (NoFeaturesSelected(session))
{
session["ATLEASTONESELECTED"] = "0";
MessageBox.Show(new Form() { TopMost = true }, "One or more
features must be selected");
}
return installResult;
}
private static bool NoFeaturesSelected(Session session)
{
return session.Features.Where(feature =>
!IgnoredFeatures.Contains(feature.Name)).All(feature =>
feature.RequestState != InstallState.Local);
}
On Mon, Sep 15, 2014 at 8:55 AM, Noel Farrugia <[email protected]>
wrote:
> I need to "access" MyFeature in the UserInterface code to make a condition
> such that if no feature is selected for installation the "Next" button can
> be disabled.
>
> Thanks and Regards,
> Noel
>
> > From: [email protected]
> > To: [email protected]
> > Date: Mon, 15 Sep 2014 12:24:04 +0000
> > Subject: Re: [WiX-users] Check that at least one Feature is selected
> >
> > Currently, there is limited scoping of properties in Wix 3.x. The only
> problem you may sometimes run into is when a property crosses the UI to
> Execute boundary--to do that, you'll need a public secure property.
> >
> > So, how exactly do you want to "access" MyFeature?
> >
> > --
> > John Merryweather Cooper
> > Senior Software Engineer | Enterprise Service Applications | Continuing
> Development
> > Jack Henry & Associates, Inc.® | Lenexa, KS 66214 | Ext: 431050 |
> [email protected]
> >
> >
> >
> > -----Original Message-----
> > From: Noel Farrugia [mailto:[email protected]]
> > Sent: Monday, September 15, 2014 7:17 AM
> > To: [email protected]
> > Subject: [WiX-users] Check that at least one Feature is selected
> >
> > Hi all,
> >
> > I have a setup with feature selection enabled like this one now, in a
> file called "MyInstaller.wxs",
> >
> > <Feature Id="MyFeature"
> >
> >
> > Title="MyTitle"
> >
> >
> > Description="Desc...."
> >
> >
> > Level="1" AllowAdvertise="no" Absent="allow"
> TypicalDefault="install">
> >
> >
> >
> > <ComponentGroupRef Id="Test Component"/>
> > .
> > .
> > .
> > </Feature>
> >
> > The code that handles the User interface is in another file called
> UserInterface.wxi.
> > I know that to check if a certain feature is selected I need to do
> <[CDATA[&MyFeature=3]]> in the "Publish" line example:
> >
> > <Publish Property="FeatureChoiceDlgPrev"
> Value="InstallWelcomeDlg">$(var.allowFeatureChoice) = 1</Publish>
> >
> > now my question is how can I access the "MyFeature" which is located in
> "MyInstaller.wxs" in the "UserInterface.wxi"file ?
> >
> > Thanks a lot for your help :)
> >
> > Noel
> >
> >
> ------------------------------------------------------------------------------
> > Want excitement?
> > Manually upgrade your production database.
> > When you want reliability, choose Perforce Perforce version control.
> Predictably reliable.
> >
> http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk
> > _______________________________________________
> > WiX-users mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/wix-users
> > NOTICE: This electronic mail message and any files transmitted with it
> are intended
> > exclusively for the individual or entity to which it is addressed. The
> message,
> > together with any attachment, may contain confidential and/or privileged
> information.
> > Any unauthorized review, use, printing, saving, copying, disclosure or
> distribution
> > is strictly prohibited. If you have received this message in error,
> please
> > immediately advise the sender by reply email and delete all copies.
> >
> >
> >
> ------------------------------------------------------------------------------
> > Want excitement?
> > Manually upgrade your production database.
> > When you want reliability, choose Perforce
> > Perforce version control. Predictably reliable.
> >
> http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk
> > _______________________________________________
> > WiX-users mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/wix-users
>
>
> ------------------------------------------------------------------------------
> Want excitement?
> Manually upgrade your production database.
> When you want reliability, choose Perforce
> Perforce version control. Predictably reliable.
>
> http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk
> _______________________________________________
> WiX-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/wix-users
>
--
Tony
------------------------------------------------------------------------------
Want excitement?
Manually upgrade your production database.
When you want reliability, choose Perforce
Perforce version control. Predictably reliable.
http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk
_______________________________________________
WiX-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wix-users