Hi I am installing files into a directory using WIX with the code below.
<Directory Id="CMSICONSDIR" Name="CMSIcons">
<Component Id="CMSICONSDIR_C" Guid="B0328FBF-D9F7-4278-B16C-28650016FF86" SharedDllRefCount="no" KeyPath="no" NeverOverwrite="no" Permanent="no" Transitive="no" Location="either">
<CreateFolder/>
<File Id="AddCamera.png" Name="AddCamera.png" DiskId="1" Source="..\..\OrionVEWorld\bin\Release\CMSICons\AddCamera.png" KeyPath="no" />
<File Id="aldownloadsmall.png" Name="al-download-small.png" DiskId="1" Source="..\..\OrionVEWorld\bin\Release\CMSICons\al-download-small.png" KeyPath="no" />
They way my application works is that a user can copy their own files in that directory overriding with what they prefer.
The problem is when I do my next install for an update, its overrides those files with the files stipulated in the install.
How do I ensure that when I run my install it does not override the existing files that are there and only adds new ones.
Unfortunately in other case I do need files that override what is there.
I do have an upgrade script section which can affect this as below
<Upgrade Id="$(var.UpgradeCode)">
<UpgradeVersion Minimum="$(var.ProductVersion)" OnlyDetect="no" Property="NEWERVERSIONDETECTED"/>
<UpgradeVersion Minimum="1.0.0.0"
IncludeMinimum="yes"
OnlyDetect="no"
Maximum="$(var.ProductVersion)"
IncludeMaximum="no"
Property="PREVIOUSVERSIONSINSTALLED" />
</Upgrade>
Any suggestions is appreciated.
You could try changing the upgrade order by modifing the sequence of RemoveExistingProducts action. You could place it after InstallFinalize (no 4 option in the link article).
Also this article explains how windows installer handles the whole file overwrite logic.
EDIT: Also add the "Never overwrite" attribute to the components.
Try adding NeverOverwrite attribute to your components. It should do the trick.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With