I am trying to overwrite a config.properties file with my WiX setup. I use systemtools:TemplateFile to replace placeholders in a template file. But the setup fails to update it since it has been changed.
I tried several things like adding RemoveFile before the systemtools:TemplateFile but it failed. I am not sure if there is any good solution to this problem.
Currently we use it like this:
<Directory Id="CONFIGS" Name="Configurations">
<Component Id="APP_CONF_FILE" Win64="no" Guid="UNIQUEUUID">
<File Id="rms.properties" Name="config.properties" Source="data\config.properties" />
<systemtools:TemplateFile Id="component.properties"
Source="[CONFIGS]config.properties"
Target="[CONFIGS]config.properties"
ExecuteOnInstall="yes">
<systemtools:TemplateFileProperty Id="version_property" Name="version" Value="$(var.Version)" />
</systemtools:TemplateFile>
</Component>
</Directory>
The MSI log shows this:
MSI (s) (0C:6C) [15:22:20:922]: File: C:\Program Files (x86)\COMPANY\PRODUCT\conf\config.properties; Won't Overwrite; Won't patch; Existing file is unversioned but modified
Is there any way to force replace it or remove it before? It should always be overwritten during an installation.
If you're asking during patching, check the REINSTALLMODE property. By default, Its value is "omus".If you want to replace files forcely, use "amus".