Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Automatic update

Tags:

c#

asp.net

wpf

I have a system with two web applications, one web service, one Windows service and a WPF application running 24 hours a day on a touch screen. All of them are connected to a database.

I want to be able to upgrade all of those applications by uploading upgrade files to the database and set the date and time for the upgrade to occur.

I have one idea on how to do this.

  1. An application has a thread running to look for available upgrades.
  2. When an upgrade is found, the file is downloaded to the application's computer.
  3. When download is complete, the applications triggers a restart.
  4. When application starts, it looks for an upgrade file on the local computer.
  5. If upgrade is available, the application upgrades itself.

I'm not really sure how all these steps should be done yet, especially the last one. But I want some comments about this. Is this completely wrong? Am I on the right track? Any tips on how to do it like this or in another way?

like image 781
Peter Hedberg Avatar asked Sep 20 '10 06:09

Peter Hedberg


1 Answers

I think you're going down the right lines here. A polling application to check the database for the existence of a new update followed by an xcopy deployment script would do it.

This might be doable from a PowerShell script too, that runs on a schedule, say every 10 minutes. It could check the database, close the process and service, xcopy the application (from a shared source) and restart the said service and app.

All this assumes that you are not using Windows Installer to package and deploy your application initially. Although an xcopy to directly replace binaries wouldn't hurt an MSI package, it's not recommended. We use AD MSI deployment at work and it's a pain at the best of times!

MSDN contains references for MSI vs XCopy deployment for WPF applications (as well as the security requirements).

This was the first link I found for querying SQL from PowerShell: http://elegantcode.com/2008/03/27/discovering-windows-powershell/

Good luck!

like image 153
Tom Avatar answered Sep 18 '22 11:09

Tom