C#打包安装程序类base.Rollback异常(有图片,有代码)
做C#打包程序。在安装程序类中需要一些对安装过程的操作。满足条件,运行,不满足,结束安装。可以在运行到base.Rollback(savedState);却抛出了一个异常,无法解决。期待高手帮忙看一下。base.Rollback(savedState);此方法放到了OnBeforeInstall里面。有图片有代码。/// <summary>
/// 重写安装之前方法
/// </summary>
/// <param name="savedState"></param>
protected override void OnBeforeInstall(System.Collections.IDictionary savedState)
{
base.OnBeforeInstall(savedState);
bool reiis = ExistSqlServerService("W3SVC");
if (reiis == false)
{
MessageBox.Show("请您先安装IIS,并重启电脑!");
//throw new ApplicationException("请您先安装IIS,并重启电脑然后运行此程序!");
base.Rollback(savedState);//报异常
}
else
{
//if (ban == "XP")
//{
// //base.OnBeforeInstall(savedState);
// XP(server, uid, targetdir);
//}
}
}
public override void Install(System.Collections.IDictionary stateSaver)
{
bool reiis = ExistSqlServerService("W3SVC");
if (reiis == false)
{
MessageBox.Show("请您先安装IIS,并重启电脑!");
//throw new ApplicationException("请您先安装IIS,并重启电脑然后运行此程序!");
base.Rollback(savedState);//没有反应,继续安装了 }
else
{
//if (ban == "XP")
//{
// //base.OnBeforeInstall(savedState);
// XP(server, uid, targetdir);
//}
}
} --------------------编程问答-------------------- 都没人 帮忙看看吗? --------------------编程问答-------------------- 没有图。 --------------------编程问答-------------------- 哈哈。lz遇见和我一样的问题了。。。。。。可惜我没有解决方案。。。
补充:.NET技术 , C#