WIX | Remove *.config file on install
Question
I have multiple config files (for different environments). During install user get to select the environment, and based on that correct files are copied. I want to delete the extra files that are not used.
I am using but it doesn't seem to be working. I don't get any errors as such, in the log I see action getting executed but files are not deleted. Can anyone please point what I am doing wrong?
<Component Id="RemoveFiles" Guid="C5D634C2-744E-4CA5-BB44-F3DE88482AB5">
<RemoveFile Id="RemoveConfigs" Name="???_*.config" On="install" />
</Component>
My RemoveFile table also looks like
FileKey Component FileName DirProperty InstallMode RemoveExtraConfigFiles RemoveExtraFiles p6wjlh9a.con|Web_*.config INSTALLDIR 1
Still it's not deleting anything
Solution
RemoveFile
or CopyFile
always run before InstallFiles
, and it finds no files in the install directory, hence it fails.
OTHER TIPS
The RemoveFiles action will try to find the files you specified in the parent directory of the component, in case you don't override it in the RemoveFile element itself (according to your sample, you don't). Make sure that it is really a folder containing that file. If the file is not found, the action won't fail - it will silently continue.