卸载 clickonce 应用程序后删除多余的文件

发布于 2024-12-10 18:11:25 字数 349 浏览 0 评论 0原文

我有一个使用 clickonce 生成 setup.exe 的项目。在运行时,我的程序会在用户文件夹内创建一些额外的文件,例如“日志”和“附件”。但是,当我从 ARP 卸载 clickonce 应用程序时,这些文件夹不会被删除。这些剩余的文件会干扰下次安装。

我知道单击一次不支持添加自定义操作来安装或卸载。我想知道是否有一种方法可以在执行卸载后以编程方式删除这些额外的文件?

我尝试过的一种方法是创建一个清理脚本并将其作为引导程序包添加到单击一次项目的先决条件中。每次安装新产品之前,以前的脏数据都会被删除。然而,这搞乱了升级案例。

关于如何删除单击卸载后留下的额外文件有什么想法吗?

谢谢你,

JS

I have a project that uses clickonce to generate the setup.exe. During the run time my program create some extra files like "Log" and "Attachments" inside the User Folder. However, those folders are not removed when I perform an uninstall of the clickonce application from the ARP. These remaining files are interfering the next install.

I know that click once does not support for adding custom action to install or uninstall. I am wondering if is there is a way that I can remove those extra file programmingly after performing uninstall?

One way I have tried was to create a cleanup script and added it as a bootstrapper package to pre-requisite of the click once project. That worked in a way that every time before a new product was installed, the previous dirty data had been removed. However, this messed up the upgrade case.

Any ideas on how to remove the extra files that left by clickonce uninstallation?

Thank you

JS

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

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

发布评论

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

评论(2

时间海 2024-12-17 18:11:25

卸载 ClickOnce 应用程序时,除了卸载 ClickOnce 应用程序之外,没有其他方法可以执行任何操作。

您是否考虑过将文件放入 ApplicationDeployment.CurrentDeployment.DataDirectory 中?然后,当应用程序卸载时,它们将被删除。

如果这些文件是项目的一部分,您可以在“应用程序文件”对话框中将类型设置为“数据”,部署时它会自动将它们放置在数据目录中。

There is no way to do anything when uninstalling a ClickOnce application other than uninstall the ClickOnce application.

Have you considered putting the files in the ApplicationDeployment.CurrentDeployment.DataDirectory ? Then they will be removed when the application is unisntalled.

If the files are part of the project, you can set the type to Data in the Application Files dialog, and it will automatically place them in the data directory when deploying.

爱,才寂寞 2024-12-17 18:11:25

此解决方案适用于多次重新安装(干净),但它不会删除上次卸载时或直到下一次安装时的数据。

尽管如此,卸载时没有自定义操作来删除超出 clickonce 范围的文件。

将文件保留在 ApplicationDeployment.CurrentDeployment.DataDirectory 中。

启动时,查看该文件是否存在于网络部署、首次运行(也会在升级时重置)的情况下存在。成功案例,这是首次安装或升级。失败的情况下,应用程序被卸载并重新安装..现在您有机会清理应用程序数据。

如果数据敏感,您可能需要使用其他解决方案在卸载时删除文件(到目前为止,我没有看到 Microsoft 为我们提供了选项)

This solution works on multiple re-installations (clean), however it doesn't remove the data on last uninstall or until the next installation takes place.

Stil there is no custom action place on uninstall to remove the files beyond clickonce scope.

Leave a file in to ApplicationDeployment.CurrentDeployment.DataDirectory.

On startup, see if the file exists on conditions network deployed, firstrun (which resets on upgarde too).. success case, it is a first installation or upgrade. Failure case, the application is been uninstalled and installing again .. now you have a chance to clean up the application data.

If the data is sensitive, you may want to use other solution to remove files on uninstall ( as of now I don't see that Microsoft is given us an option)

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