卸载期间删除文件夹 [英] Deleting folders during uninstallation
本文介绍了卸载期间删除文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在安装过程中正在创建文件夹
I am creating folders during my installation
Public Overrides Sub Install(ByVal stateSaver As System.Collections.IDictionary)
MyBase.Install(stateSaver)
InstallDir = Me.Context.Parameters("dir")
Try
Directory.CreateDirectory(folder1)
Directory.CreateDirectory(folder2)
File.Create(folder1+ "\test1.txt")
File.Create(folder2+ "\test2.txt")
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
Public Overrides Sub Uninstall(ByVal savedState As System.Collections.IDictionary)
MyBase.Uninstall(savedState)
结束子
我正在使用此代码进行卸载,但不幸的是并没有删除文件夹和文件.
如何删除文件.
问候
SK
End Sub
I am using this code for uninstalltion but unfortuantely it is not deleting the folders and files.
how do i do i delete the files.
Regards
SK
推荐答案
我不认为这很不幸.只是您没有处理而已.
您必须为此使用自定义操作":
1.将新的库("CustomActions")添加到设置项目
2.添加=>新项目=>安装程序类
3.切换到代码视图并覆盖Uninstall方法
I don''t think that this is unfortunate. It''s just that you haven''t handled it.
You have to use Custom Actions for that:
1.Add a new library ("CustomActions") to the setup project
2.Add => New Item => Installer class
3.Switch to code view and override the Uninstall method
public override void Uninstall(IDictionary savedState)
{
base.Uninstall(savedState);
// Delete folder here.
}
1.将CustomActions项目的项目输出(主输出)添加到设置项目中.
2.右键单击您的安装项目,然后单击查看=>自定义动作
3.右键单击卸载=>添加自定义操作=>应用程序文件夹=> CustomActions的主要输出
1.Add the project output (Primary Output) of the CustomActions project to the setup project.
2.Right click your setup project and click View => Custom Actions
3.Rigth click uninstall => Add Custom Action => Application Folder => Primary Output of CustomActions
这篇关于卸载期间删除文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文