...">

WIX file installation, overriding

Hey. I install files to 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" /> 

How my application works, the user can copy their own files in this directory, overriding what they prefer.

The problem is that when I do the following installation for the update, it overrides these files with the files specified in the installation.

How can I make sure that when I run my installation, it does not override existing files or add new ones.

Unfortunately, in other cases, I need files that override what is.

I have a script update section that can affect this as shown 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 are welcome.

+6
source share
2 answers

You can try changing the update order by changing the sequence of RemoveExistingProducts . You can place it after InstallFinalize (there is no option in the link article).

This article also explains how Windows Installer handles all file rewrite logic.

EDIT: Add the attribute "Never Overwrite" for components.

+5
source

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

+2
source

Source: https://habr.com/ru/post/906439/


All Articles