I want to remove the file File.txt only on uninstall, but not on an upgrade. We are using the <MajorUpgrade ...> element for upgrades.
When we use the following Component, the File will be removed every time, also on an upgrade:
<Component Id="RemoveFileComponent" Transitive="yes"  Directory="BIN" Guid="MY-GUID-HERE">
  <Condition>REMOVE=ALL AND NOT UPGRADINGPRODUCTCODE</Condition>
  <RemoveFile Id="RemoveTextFile" Name="File.txt" Directory="BIN" On="uninstall" />
</Component>
The attribute <RemoveFile ... On="uninstall" /> changes nothing on this behaviour. The file will be consequently deleted when doing an upgrade.
UPDATE:
In an <CustomAction>REMOVE=ALL AND NOT UPGRADINGPRODUCTCODE</CustomAction> the condition works correctly on an update or uninstall, but the same condition does not work correctly in and component condition: <Condition>REMOVE=ALL AND NOT UPGRADINGPRODUCTCODE</Condition>. I am not interested to use an <CustomAction> in combination of an assembly or command line statement as and unstable workaround. I am not requesting for a solution using a <CustomAction> described here: How to add a WiX custom action that happens only on uninstall (via MSI)?
I want to get work it with a component condition, described in my question.
 
     
    
