using System;
using System.Diagnostics;
using System.Collections;
using System.ComponentModel;
using System.Configuration.Install;
[RunInstaller(true)]
public class MyUninstallActionClass : Installer
{
EventLogInstaller myInstaller = new EventLogInstaller();
public override void Install(IDictionary savedState)
{
myInstaller.Log = "log";
myInstaller.Source = "MySource";
Installers.Add( myInstaller );
base.Install(savedState);
}
public override void Commit(IDictionary savedState)
{
base.Commit(savedState);
}
public override void Rollback(IDictionary savedState)
{
base.Rollback(savedState);
}
public override void Uninstall(IDictionary savedState)
{
myInstaller.Source = "MySource";
myInstaller.UninstallAction = System.Configuration.Install.UninstallAction.NoAction;
// Remove the resource from the event log.
//myInstaller.UninstallAction = System.Configuration.Install.UninstallAction.Remove;
Installers.Add( myInstaller );
base.Uninstall(savedState);
}
public static void Main()
{
Console.WriteLine("Syntax for install: installutil.exe your.exe ");
Console.WriteLine("Syntax for uninstall: installutil.exe your.exe ");
}
}
|