How to make WiX leave files after uninstall?

只谈情不闲聊 提交于 2019-11-30 08:02:26
Simeon Pilgrim

Set the Component value Permanent="yes" like so:

<Component Id="LicenseDoc" Guid="*" Permanent="yes">
    <File Id ="License.rtf" Source="$(var.SolutionDir)Installer\License.rtf" />
</Component>

Compliments of Phil Wilson from wixusers mailing-list:

See the MSI SDK docs for the Component table - set the Component guid to be null (empty). The effect of this is that the component isn't registered (so it can't be repaired) and it won't be uninstalled.

I know this question is old, but I just stumbled across it as I was looking for a way for my installer to install missing fonts, but not uninstall them when the application is uninstalled. Hope it helps someone else who may come across this question. I was a bit uncomfortable with both of the solutions provided (blank/empty Guid or set the component to permanant). So I came up with this, which worked for me:

<Feature Id="myFonts" Title="Application Fonts" Level="1">
  <ComponentGroupRef Id="Component_group_with_fonts_to_install" />
  <Condition Level="0">
    <![CDATA[REMOVE = "ALL"]]>
  </Condition>
</Feature>

This way the font feature is installed, but when being uninstalled, the feature's level is set to 0, so it is left alone.

Another way to prevent Windows Installer from deleting the component on uninstall is to set a blank or empty component GUID. This will cause the component to be installed but it will never be tracked or uninstalled.

See the MSI SDK documentation: "...if this column (ComponentId) is null the installer does not register the component and the component cannot be removed or repaired by the installer. This might be intentionally done if the component is only needed during the installation, such as a custom action that cleans up temporary files or removes an old product. It may also be useful when copying data files to a user's computer that do not need to be registered."

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