WIX | Remove *.config file on install

浪子不回头ぞ 提交于 2019-12-10 10:14:25

问题


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


回答1:


RemoveFile or CopyFile always run before InstallFiles, and it finds no files in the install directory, hence it fails.




回答2:


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.



来源:https://stackoverflow.com/questions/7120238/wix-remove-config-file-on-install

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!