WiX installer not removing files on uninstall

ⅰ亾dé卋堺 提交于 2019-12-01 14:59:16

问题


I am telling a wix MSI file to remove files on uninstall, and it's simply not registering it.

For the bundle I call the MSI file thusly:

<MsiPackage SourceFile="..\..\..\..\Kiosk\MyProject\bin\Release\MyProject.msi"        Name="MyProject.msi" DisplayInternalUI="yes" Permanent="no" />

And in the MSI file I call this:

<ComponentGroup Id="Purge" Directory="INSTALLFOLDER">
  <Component Id="PurgeFiles" Guid="">
    <RemoveFile Id="RemoveBaseFolder" Name="*" On="uninstall" Directory="INSTALLFOLDER" />
    <RemoveFile Id="RemoveLanguage_af" Directory="Language_af" Name="*.*" On="uninstall"/>
    <RemoveFile Id="RemoveLanguage_de" Name="*.*" On="uninstall" Directory="Language_de"/>
    <RemoveFile Id="RemoveLanguage_es" Name="*.*" On="uninstall" Directory="Language_es"/>
    <RemoveFile Id="RemoveLanguage_fr" Name="*.*" On="uninstall" Directory="Language_fr"/>
    <RemoveFile Id="RemoveLanguage_it" Name="*.*" On="uninstall" Directory="Language_it"/>
    <RemoveFile Id="RemoveLanguage_ja" Name="*.*" On="uninstall" Directory="Language_ja"/>
    <RemoveFile Id="RemoveLanguage_ko" Name="*.*" On="uninstall" Directory="Language_ko"/>
    <RemoveFile Id="RemoveLanguage_ru" Name="*.*" On="uninstall" Directory="Language_ru"/>
    <RemoveFile Id="Removezh_CN" Name="*.*" On="uninstall" Directory="zh_CN"/>
    <RemoveFile Id="RemoveDatabase" Name="*.*" On="uninstall" Directory="Database"/>
    <RemoveFile Id="RemoveFileData" Name="*.*" On="uninstall" Directory="FileData"/>
    <RemoveFile Id="RemoveRecordingTempData" Name="*.*" On="uninstall" Directory="RecordingTempData"/>
    <RemoveFile Id="RemoveSignatureData" Name="*.*" On="uninstall" Directory="SignatureData"/>
    <RemoveFile Id="RemoveCacheUpdater" Name="*.*" On="uninstall" Directory="CacheUpdater"/>
    <RemoveFile Id="RemoveRecordingUploader" Name="*.*" On="uninstall" Directory="RecordingUploader"/>
  </Component>
</ComponentGroup>

I then reference the component group with:

<Feature Id="ProductFeature" Title="CacheUpdaterInstaller" Level="1">
<ComponentGroupRef Id="Purge"/>
</Feature>

Why are the files not being deleted? I have tried from both the burn exe file and the MSI file itself. The program installs fine, but the removal seems to not work at all.


回答1:


SO, I found out what my issue was.

I wasn't properly adding the guids. The files and folders now properly get removed.




回答2:


Check out this thread; Removing files when uninstalling WiX

First of all, I hope you are not removing files that are installed by MSI, that would beat the purpose of MSI. It should already do that.

Secondly, you can try adding empty CreateFolder element to Component(it might be the case of component not registering, if KeyPath element is not included, or Components KeyPath="Yes" is not included).

Make sure that you use RemoveFolder element. As you can also read from the link, recursion is not supported, so you need to manually delete everything, and make sure that there are no subfolders.

Ps that's pretty tiring, you can use CustomAction to execute [System64]\cmd.exe with rmdir and include recursive flag there, then schedule it after RemoveFiles, and run it on only on UNISTALL.



来源:https://stackoverflow.com/questions/19848971/wix-installer-not-removing-files-on-uninstall

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