WiX: How to display a Feature element's "description" text? - wix

I'm building an MSI installer with WiX, and the installation requires the user to select from a couple of Features:
<Feature Id='DefaultFeature' Title="Backend Server" Level='1' Absent="disallow" AllowAdvertise="no" Description="Mandatory, must be installed.">
<!-- ... -->
</Feature>
<Feature Id='DatabaseComponents' Title="User Database" Level="1" AllowAdvertise="no" Description="Deselect this to enable Active Directory support instead.">
<!-- ... -->
</Feature>
<!-- more features -->
Note the Description attribute. The documentation says about the Description:
This localizable string is displayed by the Text Control of the Selection Dialog.
But: It's not displayed anywhere:
What am I doing wrong here?

As seen here: Add a dedicated control with type Text to the dialog that holds the SelectionTree, and subscribe to the SelectionDescription event:
<Control Id="ItemDescription" Type="Text" X="215" Y="60" Width="145" Height="120">
<Text/>
<Subscribe Event="SelectionDescription" Attribute="Text"/>
</Control>

Related

WiX root feature without Treelines

Is it possible to have the root feature in the feature tree to not have tree lines so you can't expand and collapse it?
So the following feature tree:
<Feature Id="root" Level ="1" Title="Root" Display="expand" AllowAdvertise="no"
ConfigurableDirectory="INSTALLDIR" Absent="disallow" TypicalDefault="install"
InstallDefault="local">
<Feature Id="child1" Title="Child 1"
Level="1" Display="expand" AllowAdvertise="no"
InstallDefault="local" >
<ComponentGroupRef Id="SharedComponents" />
</Feature>
<Feature Id="child2" Title="Child 2"
Level="1" Display="expand" AllowAdvertise="no"
InstallDefault="local" >
<ComponentGroupRef Id="SharedComponents" />
</Feature>
<Feature Id="childgroup1" Title="Child Group 1"
Level="1" Display="expand" AllowAdvertise="no"
InstallDefault="local" >
<Feature Id="groupchild1" Title="Child 1"
Level="1" Display="expand" AllowAdvertise="no"
InstallDefault="local" >
<ComponentGroupRef Id="SharedComponents" />
</Feature>
<Feature Id="groupchild2" Title="Child 2"
Level="1" Display="expand" AllowAdvertise="no"
InstallDefault="local" >
<ComponentGroupRef Id="SharedComponents" />
</Feature>
</Feature>
</Feature>
Gives me this:
But I'd rather not have the tree lines on the root element.
External GUI: I don't know of any way to remove the dotted lines, short of using an external GUI - which is possible (see this answer).
Hide Features: You can, however, set features to be hidden, in which case the sub-features won't show either. I am not sure exactly what you want.
Feature Four is hidden:
<Feature Id="One" Title="One" Level="1" >
<Feature Id="Two" Title="Two" Level="1"/>
<Feature Id="Three" Title="Three" Level="1">
<Feature Id="ThreeOne" Title="ThreeOne" Level="1" >
</Feature>
<Feature Id="Four" Title="Four" Level="1" Display="0" />
</Feature>
</Feature>
MSI GUI: For the record I should point out that the MSI GUI is an old relic by now from a bygone era of computing (late 90s). As such the GUI isn't that easy to do much about, except to replace the whole thing as described in the link above(and from the MSI SDK: MsiSetExternalUI).
Tools such as Installshield and Advanced Installer will allow you to use template GUIs with more modern features, and WiX allows you to write your own GUI entirely as well: WIX Installer with modern look and feel (same link as above).
All the custom GUIs are based on the MsiSetExternalUI MSI API (as far as I know).

Wix: Checkbox to modify PATH environment variable

In the Wix installer toolset, I'm trying to modify the PATH environment variable, depending on a checkbox.
Basically, the modification of PATH looks like this:
<Component Id='EnvVars' Guid='{8046-41E86196A926}'>
<CreateFolder />
<Environment Id='PathEnvVar' Action='set' System='yes' Name='PATH' Part='last' Value='[APPLICATIONFOLDER]'/>
</Component>
I have a checkbox that looks like this:
<Control Id="EnvPath" Type="CheckBox" X="10" Y="83" Width="180" Height="20" Property="ENV_PATH_MODIFY" CheckBoxValue="1" Text="Add to PATH" />
How do I connect the checkbox to the environment variable component so that the checkbox decides whether to execute the component (which modifies the PATH var)?
You can add install condition to your component directly
<Component Id='EnvVars' Guid='{8046-41E86196A926}'>
<CreateFolder />
<Environment Id='PathEnvVar' Action='set' System='yes' Name='PATH' Part='last' Value='[APPLICATIONFOLDER]'/>
<Condition>
ENV_PATH_MODIFY = 1
</Condition>
</Component>

Wix Installer - Resize fatal error dialog or use custom dialog in place of fatal error dialog

In WiX installer - How can I customize or override Fatal Error Dialog ()? I would like to show a detailed error message instead of default setup failure message.
Options:
Is it possible to resize fatal error dialog in WiX?
If not, how can I use my own dialog in place of fatal error dialog?
To resize or otherwise modify any existing dialog in essence you need to replace it. Luckily you can download original sources from git repository and modify them as you like.
Firstly to be able to modify any UI element you need to override the default UI table. Lets modify InstallDir UI for this example:
<UIRef Id="WixUI_InstallDir" /> <!-- original -->
<UIRef Id="CustomWixUI_InstallDir" /> <!-- modified -->
Now lets modify WixUI_InstallDir by downlaoading the source and changing what we want. We do that by adding a new CustomWixUI_InstallDir.wxs file to the setup. The contents can be downloaded from WixUI_InstallDir.wxs git.
Assign a unique ID for this UI by changing Id attribute of element UI inside the newly created CustomWixUI_InstallDir.wxs file:
<UI Id="WixUI_InstallDir"> <!-- original -->
<UI Id="CustomWixUI_InstallDir"> <!-- modified -->
Find a line that references the FatalError dialog and replace it with your own fatal error dialog like so:
<DialogRef Id="FatalError" /> <!-- original -->
<DialogRef Id="Custom_FatalError" /> <!-- modified -->
Now we need to download FatalError.wxs source once again or create it from scratch. Lets download the FatalError.wxs source from git once again. And add it as a new setup file named Custom_FatalError.wxs.
There still is a step to make this dialog appear after a fatal error during the setup: Find the lines in the Custom_FatalError.wxs file, that sequence this dialog and replace them with your own dialog id like so:
Original:
<InstallUISequence>
<Show Dialog="FatalError" OnExit="error" Overridable="yes" />
</InstallUISequence>
<AdminUISequence>
<Show Dialog="FatalError" OnExit="error" Overridable="yes" />
</AdminUISequence>
Modified:
<InstallUISequence>
<Show Dialog="Custom_FatalError" OnExit="error" /> <!-- note that Overridable attribute is removed -->
</InstallUISequence>
<AdminUISequence>
<Show Dialog="Custom_FatalError" OnExit="error" />
</AdminUISequence>
This is it now you can freely modify the FatalError dialog or any other dialog by following this example. I personally added a custom error message in a FatalError dialog by modifying a Description control:
<Control Id="Description" Type="Text" X="135" Y="70" Width="220" Height="80" Transparent="yes" NoPrefix="yes" Text="!(loc.FatalErrorDescription1) [CUSTOMERRORMESSAGE] !(loc.FatalErrorDescription2)" />

How to remove "Will be installed to run from network" installation options from MSI when using WiX?

Bear with me, I'm just trying to learn WiX. I'm curious how to remove the following network installation options from this popup menu (circled in red)?
EDIT: As requested below, here's the Feature node:
<Feature Id='Complete' Title='Product title' Description='The complete package.'
Display='expand' Level='1' ConfigurableDirectory='INSTALLDIR' Absent='disallow' AllowAdvertise='no' >
<Feature Id='MainProgram' Title='Program files'
Description='Installs the main executable files for the software.'
Absent='disallow'
AllowAdvertise='no'
Level='1'>
<ComponentRef Id='CompIDFile1EXE' />
<ComponentRef Id='CompIDFile2EXE' />
<ComponentRef Id='CompIDFile3EXE' />
<ComponentRef Id='CompIDFile1DLL' />
<ComponentRef Id='CompIDFile2DLL' />
<ComponentRef Id='CompIDMainRegistry' />
<ComponentRef Id='ProgramMenuDir' />
</Feature>
<Feature Id='ShortcutsStart' Title='Start Menu Shortcuts'
AllowAdvertise='no'
Description="Places software shortcuts into the Windows Start Menu."
Level='1'>
<ComponentRef Id='CompIDShortcutsStart' />
</Feature>
<Feature Id='ShortcutsDesktop' Title='Desktop Shortcut'
AllowAdvertise='no'
Description="Places software shortcut onto the users' desktops."
Level='1000'>
<ComponentRef Id='CompIDShortcutsDesktop' />
</Feature>
</Feature>
You should show your WiX source being used for the Feature elements. It's most likely a combination of the InstallDefault setting (which you probably want to be "local") and AllowAdvertise (and set it to "no").
For features that do not directly contain ComponentRef or ComponentGroupRef, you just create a dummy component inside that feature with a Location="local" attribute. This will get rid of the "run from network" options.
Example:
<Feature Id='Complete' Title='Product title' Description='The complete package.' Display='expand' Level='1' ConfigurableDirectory='INSTALLDIR' Absent='disallow' AllowAdvertise='no' >
<!-- Dummy component to get rid of the "run from network" option -->
<Component Id="CompleteDummyComponent" Location="local" Directory="TARGETDIR" Guid="GUID_HERE_PLEASE" />
<!-- sub features here -->
</Feature>

Controlling Conditional Features with a Radio Button

My problem is that I would like to allow the user to install an optional component group based on a radio-button selection.
The radio button and the Condition specified in the Feature are both bound to a Property called "InstallType". InstallType will be set to 1 to install only "client" files, but 2 to install both client and server files.
The conditional installation works correctly, based on the initial value of InstallType, but when the user changes InstallType the new value is ignored.
Here is the code in the dialog:
<Fragment>
<Property Id="InstallType" Value ="1"/>
<UI>
<Dialog
Id ="InstallationTypeDlg" Width ="370" Height ="270" Title ="Test Install Type" NoMinimize ="no">
<Control Id ="Text1" Type ="Text" Text ="Choose Install Type:" Height="17" Width="200" X="10" Y="15" />
<Control Id ="InstallTypeRadioGroup" Type ="RadioButtonGroup" Property="InstallType" X="50" Y="35" Height ="40" Width ="300">
<RadioButtonGroup Property ="InstallType">
<RadioButton Value ="1" Text ="ClientOnly" Height ="17" Width ="90" X="0" Y="10" />
<RadioButton Value ="2" Text ="ClientAndServer" Height ="17" Width ="90" X="0" Y="10" />
</RadioButtonGroup>
</Control>
</Dialog>
</UI>
</Fragment>
And here is the code in Product.wxs:
<Feature Id="ClientOnly" Title="Client Only" Level="1">
<ComponentGroupRef Id="ClientProductComponents" />
</Feature>
<Feature Id="ClientAndServer" Title="Client And Server" Level="0">
<ComponentGroupRef Id="ServerProductComponents" />
<Condition Level="1" >
<![CDATA[InstallType = "2"]]>
</Condition>
</Feature>
As shown, the code will always install the Client files, but never the Server.
If InstallType is initialized as "2", both Component Groups are installed, as expected.
I can force the outcome by hard-coding "true" or "false" in the condition evaluation.
The only thing that doesn't seem to be working is that toggling the radio button has no effect on InstallType as seen inside Product.wxs.
If I put a Text box in a dialog downstream of the radio-button dialog, I can see that InstallType contains the correct value.
I am using WIX 3.10 and VS2015.
Anyone have any idea what's wrong?
All responses appreciated.
Thanks,
Warren