Compare Page Revisions
« Older Revision - Back to Page History - Newer Revision »
installutil.exe
[RunInstaller(true)] public partial class ProjectInstaller : System.Configuration.Install.Installer { private string _dividerBar; public ProjectInstaller() { InitializeComponent(); _dividerBar = "=".PadRight(100, '='); } private void SetServiceName() { WriteLog("Setting Service Name"); var items = Context.Parameters; WriteLog(string.Format("Found the following {0} parameter(s)", items.Count)); foreach (DictionaryEntry item in items) { WriteLog(string.Format(" {0} = [{1}]", item.Key, item.Value)); } if (items.ContainsKey("ServiceName")) { var s = items["ServiceName"]; WriteLog("ServiceName = [" + s + "]"); // TODO: Change ACME_Jobs_Emailer to whatever your service is this.ACME_Jobs_Emailer.ServiceName = s; this.ACME_Jobs_Emailer.DisplayName = s; } } protected override void OnBeforeInstall(IDictionary savedState) { WriteLog(_dividerBar); WriteLog("Installing"); SetServiceName(); base.OnBeforeInstall(savedState); } protected override void OnBeforeUninstall(IDictionary savedState) { WriteLog(_dividerBar); WriteLog("Uninstalling"); SetServiceName(); base.OnBeforeUninstall(savedState); } private void WriteLog(string msg) { msg = DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss tt") + "> " + msg; this.Context.LogMessage(msg); } }
ScrewTurn Wiki version 3.0.1.400. Some of the icons created by FamFamFam. Except where noted, all contents Copyright © 1999-2024, Patrick Jasinski.