如何让WiX在卸载后留下文件?

发布于 2024-08-28 16:52:12 字数 21 浏览 4 评论 0原文

有没有办法卸载后不删除文件?

Is there a way to NOT delete files after an uninstall?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

狂之美人 2024-09-04 16:52:12

设置 ComponentPermanent="yes",如下所示:

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

备注:

  • 此定义必须在已安装的 MSI 以及升级的 MSI 中完成。如果基本 MSI 没有组件 ID,则无论 Permanent="yes" 为何,该文件都将被删除

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"
情绪 2024-09-04 16:52:12

来自 wixusers 邮件列表的 Phil Wilson 的赞美:

请参阅组件表的 MSI SDK 文档 - 将组件 guid 设置为 null(空)。这样做的结果是该组件未注册(因此无法修复)并且不会被卸载。

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.

寂寞清仓 2024-09-04 16:52:12

我知道这个问题很旧,但我只是偶然发现它,因为我正在寻找一种方法让我的安装程序安装丢失的字体,但在卸载应用程序时不卸载它们。希望它可以帮助其他可能遇到这个问题的人。我对提供的两种解决方案都有点不舒服(空白/空 Guid 或将组件设置为永久)。所以我想出了这个,这对我有用:

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

这样安装了字体功能,但是在卸载时,该功能的级别设置为 0,因此它不会被打扰。

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.

挽手叙旧 2024-09-04 16:52:12

防止Windows Installer在卸载时删除组件的另一种方法是设置空白或空组件 GUID。这将导致组件被安装,但永远不会被跟踪或卸载。

请参阅 MSI SDK 文档:“< em>...如果此列 (ComponentId) 为空,则安装程序不会注册该组件,并且安装程序无法删除或修复该组件(如果仅在安装过程中需要该组件,例如安装程序),则可能是故意这样做的。清理临时文件或删除旧产品的自定义操作在将数据文件复制到不需要注册的用户计算机时也可能很有用。”

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文