Windows Develop Bookmark and Share   
 index > ClickOnce and Setup & Deployment Projects > Event firing order in VS.NET deployment projects
 

Event firing order in VS.NET deployment projects

Hi,

I am noticing that when overriding the installer class for the following methods:

  • OnBeforeInstall
  • Install
  • Commit
  • OnAfterInstall

that the order in which these methods are called seem counterintuitive. The order in which they are being called is:

  1. OnBeforeInstall
  2. OnAfterInstall
  3. Install
  4. Commit

Why is OnAfterInstall being called before the Install method?

Thanks,

Barton

Barton Friedland  Monday, September 17, 2007 12:40 AM

Hi, Barton,

Based on my understanding, the executionorder of the installer methods is confusing, isn't it?

In my point of view, they are just working as designed.

I guess you wrote something like this

Code Snippet

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

{

base.OnBeforeInstall(savedState);

System.Windows.Forms.MessageBox.Show("Before");

}

public override void Install(System.Collections.IDictionary stateSaver)

{

base.Install(stateSaver);

System.Windows.Forms.MessageBox.Show("Install");

}

protected override void OnAfterInstall(System.Collections.IDictionary savedState)

{

base.OnAfterInstall(savedState);

System.Windows.Forms.MessageBox.Show("After");

}

http://msdn2.microsoft.com/en-us/library/system.configuration.install.installer.onbeforeinstall.aspx

http://msdn2.microsoft.com/en-us/library/system.configuration.install.installer.onafterinstall.aspx

Hope this helps,

Regards

Yu Guo â€?MSFT  Wednesday, September 19, 2007 7:51 AM

Hi, Barton,

Based on my understanding, the executionorder of the installer methods is confusing, isn't it?

In my point of view, they are just working as designed.

I guess you wrote something like this

Code Snippet

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

{

base.OnBeforeInstall(savedState);

System.Windows.Forms.MessageBox.Show("Before");

}

public override void Install(System.Collections.IDictionary stateSaver)

{

base.Install(stateSaver);

System.Windows.Forms.MessageBox.Show("Install");

}

protected override void OnAfterInstall(System.Collections.IDictionary savedState)

{

base.OnAfterInstall(savedState);

System.Windows.Forms.MessageBox.Show("After");

}

http://msdn2.microsoft.com/en-us/library/system.configuration.install.installer.onbeforeinstall.aspx

http://msdn2.microsoft.com/en-us/library/system.configuration.install.installer.onafterinstall.aspx

Hope this helps,

Regards

Yu Guo â€?MSFT  Wednesday, September 19, 2007 7:51 AM

You can use google to search for other answers

Custom Search

More Threads

• VersionNT vs VersionNT64
• AutoRun from CD
• Delete later versions in setup project (msi)
• Unable to retrieve the Target directory path from a VB Script
• How do I register my application so Windows knows where it is
• Click Once Install Problem on Client/Customer Side
• Bootstrapper AssemblyCheck version question
• it works with framework v1.0, but not v1.1 !!!!!!!!!!!
• ClickOnce deployment to multiple sites
• Deploying to Terminal Server sessions