Skip custom uninstallation (WiX)
Yes, you can do it automatically with the new installer.
Decision:
1) You need to fix the problem in a project that builds your current installer version and builds a good MSI again , from that project. In this case, you only need the MSI database, which is usually a few kilobytes, not the entire installation package (i.e. CAB files containing all installation files, etc.))
2) In the new installer, you need a custom action that takes place before the default RemoveExistingProducts action, which will update the MSI to the previous version on the machine. Your custom action should run the following command:
msiexec.exe / fv "<path_to_MSI>"
The MSI you are trying to replicate is the new one that you created in step 1. You need to include this MSI as a resource in the installer of the new version (and in future versions if some users missed this version) and give you a custom action complete the path where this MSI file is extracted, as a parameter.
Basically what you do is automate the steps to restore an old installation with the correct MSI (where you have set the correct conditions for your custom action). Now when the standard RemoveExistingProducts action is executed, Windows Installer will initiate uninstallation of the old version using the recently cached MSI that has the correct conditions set for your custom action and uninstall successfully.
source to share