How can I delete generated folders and files via Wix on uninstall?

核能气质少年 提交于 2019-12-01 06:20:30

Works now with RemoveFolderEx as suggested by Bob Arnson. But in addition to the declaration <util:RemoveFolderEx On="uninstall" Property="APPLICATIONFOLDER" /> there are also some registry declarations necessary:

<!-- add this: -->
<Property Id="APPLICATIONFOLDER">
  <RegistrySearch Key="SOFTWARE\$(var.Manufacturer)\$(var.AppName)" Root="HKLM" Type="raw" Id="APPLICATIONFOLDER_REGSEARCH" Name="Path" />
</Property>

  <Directory Id="BIN" Name="bin" />
  <Directory Id="HELP" Name="help" />
  <Directory Id="GENERATED" Name="generated" />

  <Component Id="RemoveAll" Guid="THE-GUID-HERE">
    <RemoveFile Id="RemoveAllFilesOnUninstall" Directory="APPLICATIONFOLDER" Name="*.*" On="uninstall" />
    <RemoveFolder Id="RemoveAllFoldersOnUninstall" Directory="APPLICATIONFOLDER" On="uninstall" />

    <!-- add this: -->
    <RegistryValue Root="HKLM" Key="SOFTWARE\$(var.Manufacturer)\$(var.AppName)" Name="Path" Type="string" Value="[APPLICATIONFOLDER]" KeyPath="yes" />

    <util:RemoveFolderEx On="uninstall" Property="APPLICATIONFOLDER" />
  </Component>

</Directory>

Use RemoveFolderEx in WixUtilExtension. I wrote about it on my blog back when I introduced it.

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