卸载clickonce应用程序后删除其他文件 [英] Removing extra files after uninstalling a clickonce application

查看:693
本文介绍了卸载clickonce应用程序后删除其他文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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?

我尝试过的一种方法是创建一个清理脚本并添加它作为bootstrapper程序包,是单击一次项目的前提条件。这样做的方式是,每次安装新产品之前,都会删除以前的脏数据。但是,这弄乱了升级案例。

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.

关于如何删除clickonce卸载留下的多余文件的任何想法?

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

谢谢

JS

推荐答案

在卸载ClickOnce应用程序时无法执行任何操作除了卸载ClickOnce应用程序。

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

您是否考虑过将文件放入ApplicationDeployment.CurrentDeployment.DataDirectory中?然后在取消安装应用程序时将它们删除。

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.

这篇关于卸载clickonce应用程序后删除其他文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆