You can try that by using InstallCondition
your bundle.wxs will have something like this
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:bal="http://schemas.microsoft.com/wix/BalExtension">
<Bundle Name="YourProductName" Version="1.0.0.0" Manufacturer="" UpgradeCode="aa89733d-62f6-44e9-80c7-04a69cb7c077">
<Variable Name="InstallIISEXPRESS" Value="0" bal:Overridable="yes" Type="string" />
<BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.RtfLicense" />
<Chain>
<!-- TODO: Define the list of chained packages. -->
<!-- <MsiPackage SourceFile="path\to\your.msi" /> -->
<PackageGroupRef Id ='DatabaseGrp'/>
</Chain>
</Bundle>
<Fragment>
<PackageGroup Id ='DatabaseGrp'>
<MsiPackage Id="SQLServerExpress_x86_msi"
Cache="yes"
InstallCondition= "NOT(InstallIISEXPRESS = 1)"
Visible ="yes"
Permanent="yes"
SourceFile="Path\To\Your\SQLServerExpressMSI">
<MsiProperty Name="IACCEPTQLServerExpressLICENSETERMS"
Value="YES"/>
</MsiPackage>
<MsiPackage Id="IISExpress_x86_msi"
Cache="yes"
Visible ="yes"
InstallCondition= "InstallIISEXPRESS = 1"
Permanent="yes"
SourceFile="Path\To\Your\IISExpressMSI">
<MsiProperty Name="IACCEPTIISExpressLICENSETERMS"
Value="YES"/>
</MsiPackage>
</PackageGroup>
</Fragment>
</Wix>
You need to add a reference to the BalExtension in your Bundle Project
You need to set the value of the variable InstallIISExpress from your Bootstrapper(Custom UI) project, which will decide which database MSI will get install.
You can set that value from Bootstrapper project like this
Bootstrapper.Engine.StringVariables["InstallIISExpress"] = "0";
// If you want to install SQLEXPRESSSERVER then set it to "0"
// If you want to install IISEXPRESS then set it to "1"
// You can decide this value from radio button selected by user
InstallCondition indicates whether the package should be installed or not. If the condition evaluates to true, then the package may be installed. If the condition evaluates to false, then the package should not be installed. If the package is present and the condition evaluates to false the package will be uninstalled.