tags:

views:

178

answers:

6
+5  Q: 

Automatic update

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?

+1  A: 

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!

Tom
A: 

Microsoft have an Updater Application Block which might be what you are looking for.

Dominic Zukiewicz
A: 

Do you really want to run an update from the database or is this just a possible solution? You are reinventing the wheel.

Have a look at ClickOnce deployment, everything you need is already done for you and integrated into VisualStudio. If you use something that already exists you have the benefit of existing documentation, helpful blogs of people who have already gone through the pain points and updates and fixes.

ClickOnce Deployment

ClickOnce Deployment in .NET Framework 2.0

How you want to use ClickOnce depends on what you want to get out of it. Out of the box you can very easily create a deployment that checks for an upgrade every time you run the application but you can also with a little bit of code have the application check for updates whilst it is running.

The Updater Application BlockVersion that Dominic Zukiewicz mentioned is the pre cursor to ClickOnce.

EDIT

ClickOnce provides a roll-back scenario on both the Server and Client end. The client can roll back to a previous version using the normal add remove programs dialogue and you can easily republish a previous version.

Bronumski
Sounds good. But some things I think doesn't work in my scenario. Woes it work for all of our application types (web, WPF, service)? Requires internet access for all applications? Can't pick which system installation to get the upgrade? I might be wrong on something here.
Palpie
Sorry I missed the "I want to be able to upgrade all of those applications". Short answer is no, you would use ClickOnce for a client application. If you want to upgrade all the applications the same way you may want to rethink your deployment strategy, there is rarely a one size fits all solution. What I can say is from experience when deploying to an end user ClickOnce is a very good deployment tool where all the kinks have been worked out and provides a very good user experience.
Bronumski
I'll look into it some more. Anything is better than what we do today - VPN and remote desktop to all servers we need and car to customers where we don't have VPN access.
Palpie
A: 

You will have trouble doing this with ClickOnce. ClickOnce would only work for your WPF app, it can't do anything with the services or web application. You could write a separate ClickOnce-deployed "Updater" app whose job is to update the other apps, but that still seems a little iffy.

It may sound stupid, but I'd start with the simplest thing I could think of. How about using Dropbox to push your update files; then an AutoHotKey script that runs on startup, watches the Dropbox folder for new updates, and runs them?

Sounds hokey, but it's something you could prove out in an hour or two.

whatknott
A: 

You could create another Windows Service that does the updates on a daily basis. The service would look on a specific folder if there are any updates to be process. For example it could look for an xml file which tells it the new version of the application and what the files to update are. It would shut down the application/services, backup the files that it needs to update, start the application/services, and clean up backup files keeping at least three backup files. The service should keep track of the last and current version installed so that when it reads the xml file it can check if it is a new update or not or you can simply delete the xml file when it completes.

Alex Mendez
A: 

How about Google Omaha? It's an open source tool, currently used to push updates of Google Chrome and Google Earth. Omaha can handle application installation, too. A high-level design overview can be found here.

kylan