卸载阶段不会删除项目中的所有文件 [英] All files in project are not removed during uninstallation phase

查看:71
本文介绍了卸载阶段不会删除项目中的所有文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




问题:

当用户浏览添加/删除程序时,如何确保所有程序文件都被卸载?

场景:

我的安装和部署项目没有删除以下内容:

Hi,


Question:

How do I ensure that all program files are uninstalled when a user goes through add/remove programs?

Scenario:

My setup and deployment project does not remove the following things:

1. Project.exe<br />
2. Project.exe.config<br />
3. The application folder.<br />


这些东西都没有永久属性,也没有被标记为系统文件.

那么,如果用户选择卸载应用程序,我如何保证所有文件和文件夹都被删除?


None of these things have the permanent attribute nor are they tagged as system files.

So how do I garauntee that all files and folders are removed if the user chooses to uninstall the application?

推荐答案

根据您的信息很难说,但这是一个典型的原因可能是这样的:某些可执行模块已加载到内存中,因为在卸载时正在执行使用该可执行模块的某些进程.

可能有不同的原因;其中之一可能是某些应用程序中的错误:未终止的线程使进程保持运行.如果该应用程序是系统服务,则可以使其永久执行.因此,可以调查并解决此类情况:可以修复错误,应用程序可以接收有关卸载的通知并终止;毕竟,一个过程可以用蛮力终止(虽然不好),但在.NET中,它可以通过Process.Kill来完成(同样,请务必避免这样做;有一些优美的方法基于将通知发送给a)目标进程).

—SA
Hard to say based on your information, but a typical reason would be this: some of the executable modules is loaded in memory because some process using it is being executed at the moment of uninstallation.

There can be different reasons for that; one of them could be a bug in some application: non-terminated threads keeping the process running. If the application is a System Service, it could be kept permanently executed. So, such cases can be investigated and resolved: a bug could be fixed, the application can receive notification on the uninstallation and terminate; after all, a process can be terminated by brute force (which is no nice though), in .NET it could be done via Process.Kill (again, avoid it by all means; there are graceful methods based on sending a notification to a target process).

—SA


这篇关于卸载阶段不会删除项目中的所有文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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