开发者

Exception in Custom Action during RollBack

In custom action I override following function and got exception in rollback case...

"savedState dictionary does not contain the expected values and might have been corrupted. "

Is there any other way to rollback ?

   protected override void OnBeforeInstall(System.Collections.IDictionary savedState)
    {            
        try
        {                

            bool report = false; //Some validation
            if (!report)                
                throw new InstallException("License is not valid.");
            base.OnBeforeInstall(savedState);
        }
        catch (Exception ex)
        {
            MessageBox.Show(ex.Message, "Exception", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            base.Rollback(savedState);
        }

    开发者_如何学C}


Change "base.Rollback()" in the exception handler to "throw;". Your caller will call Rollback at the correct time.


You can use pinvoke to call the cancel button on the base installer. This will rollback without any installexception error message dialogs.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜