开发者

How to make WiX leave files after uninstall?

开发者 https://www.devze.com 2022-12-26 12:17 出处:网络
Is there a way to NOT d开发者_运维技巧elete files after an uninstall?Set the Component value Permanent="yes" like so:

Is there a way to NOT d开发者_运维技巧elete files after an uninstall?


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>

Remarks:

  • This definition has to be done in the installed MSI as well as the upgrading MSI. If the base MSI did not have a component Id this file will be deleted regardless of the Permanent="yes"


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."

0

精彩评论

暂无评论...
验证码 换一张
取 消