.NET 安装项目卸载时删除安装文件夹
我有一个 .NET 安装项目,可以很好地安装和卸载我的应用程序,但卸载时它会留下安装目录。
如何在卸载期间/卸载后删除该文件夹?
更新:我的应用程序运行时会在此目录中创建一个 cahce 文件,这看起来像是卸载期间未删除该文件夹的原因。
有没有办法删除此文件以便删除该文件夹?
I have a .NET setup project that installs and uninstalls my application fine but on uninstall it leaves the installation directory behind.
How can I delete this folder during/after the uninstall?
UPDATE: My application creates a cahce file in this directory when it runs which looks like the reason the folder is not removed during the uninstall.
Is there a way to remove this file so that the folder gets removed?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
通常,安装期间创建的文件夹将在卸载时删除。
但是,如果该文件夹不为空或者另一个进程具有该文件夹或其子文件夹的打开句柄,则不会发生这种情况。因此,您应该确保该文件夹没有在资源管理器或控制台窗口中的某个位置打开,您的应用程序没有运行,并且您没有将任何其他文件放置到该文件夹中。
您可以使用 Process Explorer 检查打开的句柄查找->查找 Handle 或 Dll 命令并输入安装文件夹的名称。
您可以通过创建卸载日志来获取扩展信息和可能的错误消息:
Normally the folder created during installation will be removed on uninstall.
This does not happen however, if that folder is not empty or another process has an open handle to that folder or a subfolder within. Therefore you should make sure that the folder is not opened somewhere in Explorer or a console window, you application is not running and you didn't place any additional files to that folder.
You can check with Process Explorer for open handles using the Find -> Find Handle or Dll command and entering the name of your installation folder.
You can get extended information and possible error messages by creating a log of your uninstallation:
是的,您可以通过编写自定义操作并在删除文件表中添加条目来删除这些文件/文件夹。 删除文件
yes you can remove these files/Folder by writing Custom Actions and adding entries in Remove File table. RemoveFile