I need to know if the setup finished successfully or failed.
It is a silent setup msi, and I need to call a custom action in a .net dll that sends an e-mail with the result of setup (SUCCESS or FAILED).
Also, the setup has a cutom action to stop the Apache service when started, but I need to restart it at the end even if the setup complete successfully or failed.
All you would need to do will be to schedule your .net dll custom action as a custom action with sequence after "Install Execution Stage -> Finish Execution" action stage. If the installation reached this stage this means it has succeeded so you can send a SUCCESS report.
To send a FAILURE report you should add another custom action scheduled "During installation rollback" as a custom action with sequence just after "Install Execution Stage -> Preparing" action group. When the installation fails it will rollback and thus this custom action will be triggered.
Finally to always restart the Apache service you should add two custom actions, configured to restart the service, configured like this:
1. the first action should be scheduled as a custom action with sequence after "Install Execution Stage -> Finish Execution" action stage (in case of a successful installation)
2. the second custom action should be scheduled "During installation rollback" as a custom action with sequence just before the custom action which stops the Apache service; in case the installation will fails after the Apache service is stopped the rollback action will be triggered