[RunInstaller(true)]
public class InstallClassRegAsm: Installer
{
public InstallClassRegAsm() :base()
{
}
#region Install
//---Override the 'Install' method.
public override void Install(IDictionary savedState)
{
base.Install(savedState);
//---the assembly to register
string strAssemblyFile = base.Context.Parameters["name"].ToString();
//---checkpoint
Trace.WriteLine(string.Format("Install {0}", strAssemblyFile));
//---load assembly
Assembly objAsm = Assembly.LoadFrom(strAssemblyFile);
//---action
RegistrationServices objRS = new RegistrationServices();
objRS.RegisterAssembly(objAsm, AssemblyRegistrationFlags.SetCodeBase);
}
#endregion
#region Uninstall
//---Override the 'Uninstall' method.
public override void Uninstall(IDictionary savedState)
{
base.Uninstall(savedState);
//---the assembly to register
string strAssemblyFile = base.Context.Parameters["name"].ToString();
//---checkpoint
Trace.WriteLine(string.Format("Uninstall {0}", strAssemblyFile));
//---load assembly
Assembly objAsm = Assembly.LoadFrom(strAssemblyFile);
//---action
RegistrationServices objRS = new RegistrationServices();
objRS.UnregisterAssembly(objAsm);
}
#endregion
}
|