6

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.

2 Answers 2

5

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.

Sign up to request clarification or add additional context in comments.

1 Comment

Done <InstallExecuteSequence> <RemoveExistingProducts After="InstallFinalize"></RemoveExistingProducts> </InstallExecuteSequence> and did NeverOverwrite="yes" Permanent="yes" in my component and it still overwrites my previous files. Not sure what I am doing wrong
2

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

5 Comments

This is not enough if the RemoveExistingProducts action is before InstallExecute.
@Ciprian - Doesn't WIX schedule RemoveExistingProducts action after InstallExecute by default?
You might be right on this. I don't have extensive knowledge about WIX.
Another problem is I only want to not override if there is a file already there. When a file is absent I don want that file installed. However it seems when I put NeverOverwrite in my component it also does not install files that are absent
Old question, but it hasn't been resolved so figured I'd throw my penny in here. According to the documentation, only the KeyPath of the component is checked, so if you have multiple files in the component (like in the question), it will only check the KeyPath file, and skip any other ones if that exists. see: wixtoolset.org/documentation/manual/v3/xsd/wix/component.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.