Hi!
I develop a merge module which then will be send to customers to be incorporated in their installers. I also make my own installer.
In my merge module I have a component to remove log files not copied by installer. I want to remove the log files only when uninstalling the product, not when is being upgraded. That's why I've placed the Condition element.
<Component Id="CLUP.Agent.log" Guid="{0BA40548-261A-430E-B244-474EFC9E6D75}">
<!-- log is to be removed when uninstalling (not upgrading) -->
<Condition>(NOT UPGRADINGPRODUCTCODE)</Condition>
<RemoveFile Id="RemoveLogs" Name="CLUP.Agent.log.*" On="uninstall" />
</Component>
In my installer I have statements to do upgrade:
<!-- Upgrade conditions -->
<Upgrade Id="$(var.INSTALLER.UPGRADECODE)">
<!-- Detect any newer version of this product -->
<UpgradeVersion Minimum="$(var.RELEASEVERSION)"
IncludeMinimum="no"
OnlyDetect="yes"
Language="1033"
Property="NEWPRODUCTFOUND"/>
<!-- Detect and remove any older version of this product -->
<UpgradeVersion Minimum="0.0.0"
IncludeMinimum="yes"
Maximum="$(var.RELEASEVERSION)"
IncludeMaximum="no"
Language="1033"
Property="OLDPRODUCTFOUND"/>
</Upgrade>
<CustomAction Id="PreventDowngrading" Error="Newer version of this product is already installed."/>
<InstallExecuteSequence>
<!-- Prevent downgrading -->
<Custom Action="PreventDowngrading" After="FindRelatedProducts">NEWPRODUCTFOUND</Custom>
<!-- Remove older version before installation of new version (InstallInitialize step) starts -->
<RemoveExistingProducts After="InstallInitialize" />
</InstallExecuteSequence>
When I run this installer with version higher then installed, so when upgrade should take place, the log files are removed anyway.
I've examined installation log made during the upgrade and found, that the condition property - UPGRADINGPRODUCTCODE - is set properly:
MSI (s) (B4:14) [08:09:01:448]: PROPERTY CHANGE: Adding UPGRADINGPRODUCTCODE property. Its value is '{A1D231E5-229D-425F-848F-D3A81C445257}'.
Log removal action occurs much later:
Action 8:09:39: RemoveFiles. Removing files
MSI (s) (B4:14) [08:09:39:841]: Executing op: ProgressTotal(Total=1,Type=1,ByteEquivalent=175000)
MSI (s) (B4:14) [08:09:39:841]: Executing op: SetTargetFolder(Folder=C:\Program Files\ClUp\Agent)
MSI (s) (B4:14) [08:09:39:841]: Executing op: FileRemove(,FileName=Clup.Agent.log,,)
So why logs are moved?What is wrong?