How to determine which radio button is selected?

Feb 7, 2013 at 4:45 PM
Here's my setup:
  • Compiling at .NET 4.0 (this cannot change)
  • Using WiX 3.7
So I'm creating a bootstrapper installation project and though I've got it working, I feel like there is a much more clean and easy way to do it.

Basically, I need to have the user select which environment they wish to use when they install the product by putting radio buttons on the welcome page.

Getting that all setup was fine, but then I realized that I don't know how to easily determine which radio button has been selected. So as I work around I just listed the MSI three times in the bundle and put install conditions on each one.

Is there a way to determine which radio button has been selected with just one property? (For example, when I pass the InstallFolder property to my MSI as seen in the code below.) And if there isn't a way to do this currently, is there a way for me to do this without adding my MSI three times to the bundle?

Here's my code (Notice how I list essentially the same MsiPackage three times):
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns=""
  <?include Properties.wxi ?>

  <Bundle Name="!(loc.Product.Name)" Version="$(var.Version)" Manufacturer="!(loc.Product.Manufacturer)" UpgradeCode="$(var.UpgradeCode)" Condition="VersionNT >= v5.1">
    <BootstrapperApplicationRef Id="WixExtendedBootstrapperApplication.Hyperlink2License">
      <bal:WixExtendedBootstrapperApplication SuppressRepair="yes" LicenseUrl="" ThemeFile="$(var.Bundle.ExtTheme.RadioBtns.Path)" LocalizationFile="$(var.Bundle.ExtTheme.RadioBtns.l10n.Path)" />

    <WixVariable Id="WixMbaPrereqPackageId" Value="Netfx4Full" />

    <Variable Name="InstallFolder" Type="string" Value="$(var.InstallFolder.Value)" />

    <Variable Name="RadioButton1" Type="numeric" Value="0" />
    <Variable Name="RadioButton2" Type="numeric" Value="0" />
    <Variable Name="RadioButton3" Type="numeric" Value="1" />

      <!-- Other Package References Here -->

      <MsiPackage Id="DBConnections_Dev"
                  InstallCondition="RadioButton1 = 1">
        <MsiProperty Name="INSTALLFOLDER" Value="[InstallFolder]" />
        <MsiProperty Name="SELECTED_ENV" Value="1" />
      <MsiPackage Id="DBConnections_Stage"
                  InstallCondition="RadioButton2 = 1">
        <MsiProperty Name="INSTALLFOLDER" Value="[InstallFolder]" />
        <MsiProperty Name="SELECTED_ENV" Value="2" />
      <MsiPackage Id="DBConnections_Prod"
                  InstallCondition="RadioButton3 = 1">
        <MsiProperty Name="INSTALLFOLDER" Value="[InstallFolder]" />
        <MsiProperty Name="SELECTED_ENV" Value="3" />
Feb 7, 2013 at 5:00 PM
The way I do it is to pass all the radio button values in to the MSI and put the detection logic in there. E.g.
<MsiProperty Name="SELECTED_ENV1" Value="[RadioButton1]" />
<MsiProperty Name="SELECTED_ENV2" Value="[RadioButton2]" />
<MsiProperty Name="SELECTED_ENV3" Value="[RadioButton3]" />
It is not very pretty but at the moment I don't have another solution.
Feb 14, 2013 at 7:00 PM
This can now be done using the custom actions feature.
Feb 15, 2013 at 7:27 PM
While this does fix the issues that I'm having, it seems that the install folder field in options is now automatically set to "C:\Windows\Microsoft.NET\Framework\v3.5\" regardless of what I've previously set the InstallFolder variable as. Is this a bug?
Feb 15, 2013 at 10:41 PM
Edited Feb 16, 2013 at 9:29 AM
The CA is just a sample to show what is possible, just delete what you don't need.