This one cost me a lot of wasted time recently. I was authoring an MSI package using the otherwise excellent open source WiX package from Microsoft and kept getting 1721 errors when a custom action was supposed to run. If you get this problem, let me attempt to save you a bit of time.
If you author a type 50 custom action that runs an exe on the system, based on a registry app search in combination with a type 51 action for example, make sure you don’t put quotes around the property that defines the exe path in the type 51 custom action. In other words, don’t author it as “EXEPROPERTY”, but just EXEPROPERTY.
You may think you need the quotes if your exe path has a space in it somewhere, but you don’t.
Now, if your type 50 action uses an ExeCommand and part of that has spaces in it, that usually needs to be quoted.
Looks inconsistent to me, but I guess the ways of the Windows Installer are inscrutable and mystical at times.
My type 50 action actually ended up as 1138 or something because of deferred execution and no impersonation, but basically the same idea applies.