levarius
levarius

Reputation: 1068

Schedule RelatedBundle Action before primary Bundle

I have an application that needs to uninstall a related bundle before installing itself. I can correctly detect it, and set it's state to Absent in OnPlanRelatedBundle(), but it isn't removed until after my new package is installed. Is there any way to set the related bundle action to happen prior to the main bundle?

    <RelatedBundle Action="Detect" Id="the-other-id" />

In the code behind, I've got the following for detected related bundle

private void OnDetectedRelatedBundle(object sender, DetectRelatedBundleEventArgs e) 
{ 
    if (e.Operation == RelatedOperation.None && e.RelationType == RelationType.Detect) 
    { 
        // If the other app is installed, we want to save the product code,
        // so we can uninstall it like we were upgrading it 
        m_relatedBundleId = e.ProductCode; 
    } 
} 

And for the planning related bundle

private void OnPlanRelatedBundle(object sender, PlanRelatedBundleEventArgs args) 
{ 
    // If we've detected the related app, we want to schedule it to be uninstalled (State = Absent) 
    if (args.BundleId == m_relatedBundleId) 
    { 
        args.State = RequestState.Absent; 
    } 
}

Upvotes: 2

Views: 779

Answers (1)

Bob Arnson
Bob Arnson

Reputation: 21886

Today, all related bundle actions after the current bundle's action. If you have a convincing use case to offer other schedulings, open a feature request at http://wixtoolset.org/issues/.

Upvotes: 2

Related Questions