If I understand correctly, you need to uninstall some existing application A before you install application B. In that case you may look into custom action which will do this for you. This custom action should execute before you install application B. The book you ordered covers everything you need.