Please keep in mind that this is done automatically if you select the "Uninstall old version first and then install new version" option from the "Upgrades" page of your project. Also, the new version of your application should be higher than the version already installed on the machine.
If you want to keep the same version, you can set the "Uninstall a package with the same version (if found)" option from the "Builds" page.
Let me know if this helped, otherwise give me more details about your scenario.