Figured it might help to share some of my code.
Inside the service OnStart, I have the following snippet -
_updater = new AutomaticUpdaterBackend{ GUID = "<myguidhere>", UpdateType = UpdateType.Automatic, wyUpdateLocation = Path.Combine(progFolder, "wyUpdate.exe"), wyUpdateCommandline = " /fromservice", ServiceName = this.ServiceName};_updater.ReadyToBeInstalled += Updater_ReadyToBeInstalled;
if (_updater.UpdateStepOn == UpdateStepOn.Nothing){ _updater.ForceCheckForUpdate();}
And the supporting code -private static void Updater_ReadyToBeInstalled(object sender, EventArgs e){ if (_updater.UpdateStepOn == UpdateStepOn.UpdateReadyToInstall) { StopApp(); _updater.InstallNow(); }}
static void StopApp(){ var args = @"/im MyApp.exe /f /t";
var psi = new ProcessStartInfo("taskkill", args); psi.Verb = "runas"; psi.CreateNoWindow = true; psi.WindowStyle = ProcessWindowStyle.Hidden; psi.UseShellExecute = true;
var process = Process.Start(psi); if (process != null) process.WaitForExit();}