Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WIX installing files, override

Tags:

wix

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.

like image 460
TheWommies Avatar asked Jan 19 '12 23:01

TheWommies


2 Answers

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.

like image 131
Ciprian Avatar answered Nov 03 '22 00:11

Ciprian


Try adding NeverOverwrite attribute to your components. It should do the trick.

like image 28
imagi Avatar answered Nov 03 '22 02:11

imagi