title: How can I perform a custom action in WiX that only executes on install or uninstall?
body: <p>I have two custom actions, one of which I'd like to execute when my product is installed and the other when it is uninstalled.</p>
  
  <p>My custom action is currently called from a merge module after the "InstallFinalize", but this happens for both install and uninstall. I've tried adding the "NOT INSTALLED AND NOT UPGRADINGPRODUCTCODE" condition, but that gave me an error:</p>
  
  <blockquote>
    <p>Error 2762. Cannot write script record. Transaction not started.</p>
  </blockquote>
  
  <p>I've also tried attaching to other actions (for example, UnpublishComponents), but I can't find any that are unique to install or uninstall.</p>
  
  <p>How can I fix this problem?</p>