//附Installer类using System;namespace MyInstaller
{
/// <summary>
/// MyInstaller 的摘要说明。
/// </summary>
public class MyInstaller:System.Configuration.Install.Installer 
{
public MyInstaller():base()
{
//
// TODO: 在此处添加构造函数逻辑
//
this.BeforeInstall+=new System.Configuration.Install.InstallEventHandler(MyInstaller_BeforeInstall);
this.AfterInstall+=new System.Configuration.Install.InstallEventHandler(MyInstaller_AfterInstall);
this.Committed+=new System.Configuration.Install.InstallEventHandler(MyInstaller_Committed);
this.Committing+=new System.Configuration.Install.InstallEventHandler(MyInstaller_Committing);

} private void MyInstaller_BeforeInstall(object sender, System.Configuration.Install.InstallEventArgs e)
{
System.Windows.Forms.MessageBox.Show("before install"); } private void MyInstaller_AfterInstall(object sender, System.Configuration.Install.InstallEventArgs e)
{
System.Windows.Forms.MessageBox.Show("after install"); }        private void MyInstaller_Committed(object sender, System.Configuration.Install.InstallEventArgs e)
{
System.Windows.Forms.MessageBox.Show("MyInstaller_Committed");
} private void MyInstaller_Committing(object sender, System.Configuration.Install.InstallEventArgs e)
{
System.Windows.Forms.MessageBox.Show("MyInstaller_Committing");
} protected override void OnBeforeInstall(System.Collections.IDictionary savedState)
{
base.OnBeforeInstall (savedState);
System.Windows.Forms.MessageBox.Show("before install");
new InstallDir().Show(); }
// Override the 'Install' method.
public override void Uninstall(System.Collections.IDictionary savedState)
{
base.Uninstall (savedState);
} public override void Commit(System.Collections.IDictionary savedState)
{
base.Commit (savedState);
} public override void Install(System.Collections.IDictionary stateSaver)
{
base.Install (stateSaver);
}
}
}