Daniel
Daniel

Reputation: 103

WiX - Feature-Condition not working

I have a Wix-Installer and added a Radio-Button Group to my TargetFolder-Selection-Dialog:

  <Property Id="INSTALLATION_TYPE" Secure="yes" Value="Server"/>
  <RadioButtonGroup Property="INSTALLATION_TYPE">
    <RadioButton Height="17" Text="Client" Value="Client" Width="342" X="0" Y="0" />
    <RadioButton Height="17" Text="Server" Value="Server" Width="342" X="0" Y="18" />
  </RadioButtonGroup>

When switching between Server and Client, following output is printed to the MSI-Logfile:

MSI (c) (04:B4) [17:17:56:295]: PROPERTY CHANGE: Modifying INSTALLATION_TYPE property. Its current value is 'Server'. Its new value: 'Client'.

My Feature-Table locks like followed:

  <PropertyRef Id="INSTALLATION_TYPE"/>
  <Feature Id="CommonFeature" Level="1" Title="Common Feature">
    <ComponentGroupRef Id="Common"/>
    <ComponentGroupRef Id="RegistryKeys"/>

    <Feature Id="FeatureServer" Title="Server" Level="2">
      <Condition Level="1"><![CDATA[INSTALLATION_TYPE="Server"]]></Condition>
      <ComponentGroupRef Id="Server"/>
      <ComponentGroupRef Id="AdminConsole"/>
    </Feature>

    <Feature Id="FeatureClient" Title="Client" Level="2">
      <Condition Level="1"><![CDATA[INSTALLATION_TYPE="Client"]]></Condition>
      <ComponentGroupRef Id="Client"/>
    </Feature>
  </Feature>

But Feature Client and Server are never installed when selecting RadioButton "Client". Feature Server is always installed. Logfile says following:

MSI (s) (DC:5C) [17:18:35:750]: Feature: FeatureServer; Installed: Absent;   Request: Null;   Action: Null
MSI (s) (DC:5C) [17:18:35:753]: Feature: FeatureClient; Installed: Absent;   Request: Null;   Action: Null
MSI (s) (DC:5C) [17:18:35:755]: Feature: CommonFeature; Installed: Absent;   Request: Local;   Action: Local

What am I doing wrong?

Upvotes: 5

Views: 1485

Answers (1)

Brian Sutherland
Brian Sutherland

Reputation: 4798

Try defining the INSTALLATION_TYPE in the < Product> portion of your installer.

I think what is happening is that you are defining the INSTALLATION_TYPE property in the client side (UI) of the installation only even though it is marked secure.

In the small snippets of the log we can see

MSI (c)

This indicates this part of the logging is happening during the UI portion of the install. Whereas,

MSI (s)

indicates that this logging is happening during the server (elevated) part of the install.

At the end of your installation file you probably have a bunch of lines that start like this

Property(S)

All the properties with (S) are what the elevated portion of the install has access to. I'm going to bet INSTALLATION_TYPE is not listed in the (S) properties and that you only technically defined it for the UI (client) portion of the installation. This would explain why neither of your client or server features are being installed.

Also when using conditionally installed features that are "Do not install" by default, you need to add "OR Installed" to the condition turning them on.

When I was authoring some installers I had features that were off be default and if I installed them there were issues during either uninstall or upgrades (I can't remember which) which caused the installer to be unable to properly fully uninstall. This had machines in weird states where the installer wouldn't work. Adding the "OR Installed" condition to the feature enabling condition fixed this issue for me.

Upvotes: 2

Related Questions