为什么我的卸载方法没有被调用?
我的 VS 2008 创建的安装程序不会调用安装程序类中的覆盖 Uninstall
方法。为什么?调用了Install
方法。 我的安装程序类如下所示:
[RunInstaller(true)]
public partial class InstallerClass : Installer
{
public InstallerClass()
{
InitializeComponent();
}
public override void Install(IDictionary stateSaver)
{
base.Install(stateSaver);
//encrypt connection string
encryptConntStr();
//create database
createDatabase();
}
public override void Commit(IDictionary savedState)
{
base.Commit(savedState);
}
public override void Rollback(IDictionary savedState)
{
base.Rollback(savedState);
}
public override void Uninstall(IDictionary savedState)
{
base.Uninstall(savedState);
System.Diagnostics.Debugger.Break();
MessageBox.Show("I am in Uninstall now.");
string exePathStr = Context.Parameters["targetdir"];
...
}
}
编辑:
My VS 2008 created installer doesn't call the override Uninstall
method in my installer class. why? The Install
method was called.
My installer class looks like this:
[RunInstaller(true)]
public partial class InstallerClass : Installer
{
public InstallerClass()
{
InitializeComponent();
}
public override void Install(IDictionary stateSaver)
{
base.Install(stateSaver);
//encrypt connection string
encryptConntStr();
//create database
createDatabase();
}
public override void Commit(IDictionary savedState)
{
base.Commit(savedState);
}
public override void Rollback(IDictionary savedState)
{
base.Rollback(savedState);
}
public override void Uninstall(IDictionary savedState)
{
base.Uninstall(savedState);
System.Diagnostics.Debugger.Break();
MessageBox.Show("I am in Uninstall now.");
string exePathStr = Context.Parameters["targetdir"];
...
}
}
EDIT:
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
确保 CustomActionData 属性不为空。在我的例子中,它是空的并导致了这个问题。
make sure the CustomActionData property is not empty. Some how it was empty in my case and cause that problem.