installutil.exe
/ServiceName
[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); } }
app.config
ACME.Jobs.Emailer
rem TODO: Replace all instances of "ACME.Jobs.Emailer" with the name of your service rem ============================================================================================================== rem ===== INSTALL UAT ============================================================================================ rem ============================================================================================================== %windir%\Microsoft.NET\Framework64\v4.0.30319\installutil.exe /u /ServiceName="ACME.Jobs.Emailer - UAT" .\UAT\ACME.Jobs.Emailer.exe %windir%\Microsoft.NET\Framework64\v4.0.30319\installutil.exe /ServiceName="ACME.Jobs.Emailer - UAT" .\UAT\ACME.Jobs.Emailer.exe rem ============================================================================================================== rem ===== INSTALL DEMO =========================================================================================== rem ============================================================================================================== %windir%\Microsoft.NET\Framework64\v4.0.30319\installutil.exe /u /ServiceName="ACME.Jobs.Emailer - DEMO" .\DEMO\ACME.Jobs.Emailer.exe %windir%\Microsoft.NET\Framework64\v4.0.30319\installutil.exe /ServiceName="ACME.Jobs.Emailer - DEMO" .\DEMO\ACME.Jobs.Emailer.exe rem ============================================================================================================== rem ===== INSTALL TRAINING ======================================================================================= rem ============================================================================================================== %windir%\Microsoft.NET\Framework64\v4.0.30319\installutil.exe /u /ServiceName="ACME.Jobs.Emailer - TRAINING" .\TRAINING\ACME.Jobs.Emailer.exe %windir%\Microsoft.NET\Framework64\v4.0.30319\installutil.exe /ServiceName="ACME.Jobs.Emailer - TRAINING" .\TRAINING\ACME.Jobs.Emailer.exe rem ============================================================================================================== rem ===== INSTALL PRODUCTION ===================================================================================== rem ============================================================================================================== %windir%\Microsoft.NET\Framework64\v4.0.30319\installutil.exe /u /ServiceName="ACME.Jobs.Emailer - PRODUCTION" .\Release\ACME.Jobs.Emailer.exe %windir%\Microsoft.NET\Framework64\v4.0.30319\installutil.exe /ServiceName="ACME.Jobs.Emailer - PRODUCTION" .\Release\ACME.Jobs.Emailer.exe
install-amazon.bat
bin
copy /y "$(ProjectDir)install-amazon.bat" "$(TargetDir)..\install-amazon.bat"