tags:

views:

198

answers:

6

Is it possible to update an application to a new version without closing it?

Or is there a good way to do that without user noticing it was closed?

+6  A: 

Typically applications notice on startup that an update is available, then ask the user whether it's okay to update. They then start the update process and exit. The update process replaces the files, then launches the new version.

In some cases you may be able to get away with updating some pieces of an application without a restart - but the added complexity is significant, and frankly it's better not to try in 99% of cases, IMO.

Of course, you haven't said what kind of app you're writing - if you could give more information, that would help.

Jon Skeet
+3  A: 

The application needs to be closed before updating it, because updating an application generally means replacing the executable files (.exe, .dlls, etc.) with their newer versions, and this can't be done without closing the application.

As Jon said, in some cases, you can upgrade the application without closing it. But, this is not advisable, as it might cause failure in the updater, and the whole update might rollback.

Updater can be another executable which will first close the main application, then download the updates, apply them, start the main application, and exit (An example of this is Skype, FireFox, etc.)

Kirtan
A: 

You could separate the backend into a separate process/module and update the the backend by restarting it without the user realizing it.

Updating the front end will be a bit trickier, but could be avoided or delayed, if necessary.

Joachim Sauer
A: 

A nice and clean way to achieve this would be using dynamic plugins. You can code your application heavily plugin-based. When an update is needed, unload the plugin that needs to be updated, update the .dll file and load it back into the application. However, making this invisible to the user may be a tough job, therefore it depends heavily on your design and coding.

erelender
A: 

I remember InTime having the ability to swap exe's live, however that had to be carefully coded. I know it's possible but as Jon Skeet said, you're likely better off not trying.

Unless you're doing some kind of automation or something very serious... even then, you should consider a failover so you can shut one down / restart if needed.

Nazadus
A: 

If you has some some sort of skeletal framework which launched your application and dlls, you could look at CreateDomain. It will take serious design efforts on your part though. Good luck!

DanDan