We have been working on rebuilding our installer with WIX and Burn, using a custom bootstrapper application. We are using a feature tree in our main MSI, and have set EnableFeatureSelection="yes" so that we can replicate the feature tree in our custom BA UI and send those feature selections down to the MSI at plan/apply time. This has all been working well until we started recently to test the upgrade process. We have run into what appears to be an open bug in Burn:
http://wixtoolset.org/issues/4616/
When we do a minor upgrade, the features that are already installed do not get upgraded...the originally installed code remains on the machine. From the testing and investigation we've done, we believe it's because Burn isn't passing REINSTALL="ALL" to the MSI package (which is what the above bug says).
We found this question where Rob says you have to handle the OnPlanMsiFeature() callback, which we are doing correctly.
wix pass option to msi for repair
Since the above bug has been open since Dec 2014, we didn't have confidence that it would be fixed soon, so we decided that we would try to find a workaround. What we've come up with so far is hackish at best, but at a proof of concept level, it shows some promise. We are copying the entire MsiPackage node, giving the copy a new ID and adding a property with REINSTALL=ALL on it, like this:
<MsiPackage Id="MSI"
Cache="yes"
Compressed="no"
DisplayInternalUI="no"
Vital="yes"
Visible="yes"
EnableFeatureSelection="yes"
SourceFile="<path to MSI>">
</MsiPackage>
<MsiPackage Id="MSI_REINSTALL"
Cache="yes"
Compressed="no"
DisplayInternalUI="no"
Vital="yes"
Visible="yes"
EnableFeatureSelection="yes"
SourceFile="<path to MSI>">
<MsiProperty Name="REINSTALL" Value="ALL"/>
</MsiPackage>
Then, in our custom BA, we are using the DetectRelatedMsiPackage event to detect a minor upgrade. And using that minor upgrade detection to set the RequestState for each MsiPackage to either Local or None inside our PlanPackageBegin event handler, like this:
if (e.PackageId == "MSI")
{
if (Operation == RelatedOperation.MinorUpdate)
{
e.State = RequestState.None;
}
else
{
e.State = RequestState.Present;
}
}
if (e.PackageId == "MSI_REINSTALL")
{
if (Operation == RelatedOperation.MinorUpdate)
{
e.State = RequestState.Present;
}
else
{
e.State = RequestState.None;
}
}
We're hoping to have some guidance from others who have run into this error with upgrades in Burn with EnableFeatureSelection turned on. Will our workaround do the job? Alternatively, is there a way to dynamically create an MsiProperty from the custom BA so we can create REINSTALL=ALL as needed? Does anyone have other ideas of how to workaround this issue that are cleaner and/or more reliable?
If you need more information, let me know. We've been working with Wix/Burn for a couple months now, so we know some things...but we're not experts yet.