在组件元素上,可以添加:
RemoveFile、RemoveFolder、removeGistryKey和removegistryValue元素。看见
http://wixtoolset.org/documentation/manual/v3/xsd/wix/component.html
示例(用于文件夹和密钥):
<Directory Id="ProgramMenuFolder" Name="Programs">
<Directory Id="ProgramMenuDir" Name="AppName $(var.Version)">
<Component Id="ProgramMenuDir" Guid="*">
<RemoveFolder Id='ProgramMenuDir' On='uninstall' />
<RegistryValue id= Root='HKCU' Key='Software\[Manufacturer]\[ProductName]' Type='string' Value='' KeyPath='yes' />
<RemoveRegistryKey Id='RegCleanup' Root='HKCU' Action='removeOnInstall' Key='Software\[Manufacturer]\[ProductName]'/>
</Component>
</Directory>
</Directory>
如果不想覆盖父组件目录,则可以省略目录属性。
据我所知,RemoveFolder组件的Id应该与要删除的目录的Id相匹配(这对我适用)。
在您的情况下,这将转化为以下内容:
<Directory Id="LocalAppDataFolder">
<!-- perUser case, it is redirected automatically to LocalAppDataFolder -->
<Directory Id="ProgramFilesHK" Name="$(var.Manufacturer)">
<Directory Id="APPLICATIONFOLDER" Name="$(var.ApplicationName)">
<Component Id="CMP_dosomething_exe" Guid="0BA6F4AB-9ED4-4CF2-BDFF-0C95F1DF4BA0" Permanent="no">
<CreateFolder />
<RemoveFolder Id="ProgramFilesHK" On="uninstall" />
<RemoveFolder Id="APPLICATIONFOLDER" On="uninstall" />
[removed stuff]
</Component>
</Directory>
</Directory>
</Directory>