0

I'm seeking advice on the common way that this sort of situatiton is handled. I have an application with 5 assemblies that is set out as follows:

  1. Windows Service A using shared Library A
  2. Windows UI App A using shared Library A
  3. Windows Service B using Library B

One of the tasks Service B performs is to check for updates, download and verify update files, and launch a utility updater.exe (or whatever) that will perform the update.

The updater.exe must be capable of updating all 5 assemblies at the same time. It should also be capable of performing the update whether or not the UI App is running.

Since updater.exe is launched by Service B there is no issue with the updater connecting to the services, stopping them, and replacing the files before restarting them. Also, the updater can enumerate the running processes and replace the UI App if it is not running. But since Library A is shared it can only be replaced if the UI is not running.

How can I update the UI App and Library A, from a service-launched process, if the UI is running, including relaunch of the UI App if it the process is stopped or killed?

More generally, are there common/typical ways of doing this sort service + library + ui application update? I'm happy to reconsider my approach.


I should mention that the services have been written to be self-installed/uninstalled from command line.

khargoosh
  • 1,450
  • 15
  • 40
  • I am assuming you application is WPF. Kindly check following library https://msdn.microsoft.com/en-us/library/gg405497(v=pandp.40).aspx – null1941 Jan 29 '16 at 00:59
  • have you considered repackaging your app with ClickOnce? the need for Service B and updater.exe should go away, though you may need to do a bit extra work to launch/stop Service A – Sten Petrov Jan 29 '16 at 00:59
  • @null1941 The UI app is a WinForms app. – khargoosh Jan 29 '16 at 01:00
  • http://stackoverflow.com/questions/5006584/automatically-update-wpf-application – null1941 Jan 29 '16 at 01:00
  • try explore clickonce, it may helps – null1941 Jan 29 '16 at 01:01
  • @StenPetrov I was under the impression that it was difficult to update services via ClickOnce, also the app should be present for all users of the system. Is it possible? – khargoosh Jan 29 '16 at 01:02
  • @StenPetrov also, `Service B` is responsible for other tasks, not just updating, and the need for it won't go away regardless. – khargoosh Jan 29 '16 at 01:10
  • Assuming you can't find a way to kill your running application and tell it to restart or the one click install does not satisfy your update needs then there is another option. You could run the update as a "Run Once". Add the entry into the registry for your updater app to run the update on reboot prior to user apps starting. This will ensure your run once app is loaded before the any user apps can start. The downside is that you have to wait for a reboot. – Ross Bush Jan 29 '16 at 01:17
  • @Irb which might not happen for weeks, depending on the user. It's a good idea to explore this as a backup option. Thank you :-) – khargoosh Jan 29 '16 at 01:18
  • @Irb I can certainly kill the running UI application process, but how to tell it to restart? Killing doesn't seem graceful if there is another option. – khargoosh Jan 29 '16 at 01:21
  • @Irb after thinking more about this, and given my situation, this is likely the simplest and most robust solution. – khargoosh Jan 29 '16 at 01:30
  • @khargoosh I believe you have some installation hooks from within the app using ClickOnce API where you could launch a separate setup for Service B. I've dealt with this exact scenario before and with a bit of reachitecture ClickOnce worked just fine – Sten Petrov Jan 29 '16 at 06:26

0 Answers0