I am fairly new to WiX so may be I am asking something very straight forward but I couldn't find much help googling it.
I want to perform 2 customActions, say, ca1 and ca2, where execution of ca2 depends on outcome of ca1, something like below:
if ( ca1 == SUCCESS )
{
Perform ca2
}
So ca2 should only be executed if my ca1 returns success (doesnt fails).
What is the easiest way to do this in WiX ?
What you describe is the default. If a custom action fails, the installation aborts, and only rollback actions may execute afterward. So for your question to make sense, first you have to ignore or otherwise mask failures on your first custom action.
Second, the only way for one action to know the return result of another is if it invoked it by calling MsiDoAction (or some wrapper thereof). Doing that would blur the lines between your custom actions, so I'm going to assume that's not the scenario you're describing.
That leaves you with the third and final way: find an external communication channel. For immediate actions, I would suggest that ca1 sets a property upon success (call MsiSetProperty or a wrapper like DTF's session[property]), and ca2 either reads (MsiGetProperty / MsiEvaluateCondition) or is directly conditioned against the value of that property. For deferred actions, properties don't propagate, so you would have to identify some other channel. (Perhaps a temporary file whose path is chosen ahead of time would work.)
But the entire scenario is a little unusual for Windows Installer; I would recommend avoiding it. Perhaps merge your actions so that any failure scenarios can be handled "internally" before bubbling back to the sequence. Or perhaps the specifics of your actions might lead towards more specific suggestions.