Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WiX installer not removing files on uninstall

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.

like image 296
Chris None Avatar asked Nov 07 '13 23:11

Chris None


2 Answers

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.

like image 39
Erti-Chris Eelmaa Avatar answered Nov 09 '22 18:11

Erti-Chris Eelmaa


SO, I found out what my issue was.

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

like image 74
Chris None Avatar answered Nov 09 '22 17:11

Chris None