views:

4634

answers:

10

Hi gents, I've been thinking of rolling my own code for enabling my Delphi application to update seamlessly as I'll be going for "release often, release early" mentality furthermore. There are various Delphi solutions both freeware or paid out there and I'd like to ask if you've been using any of them or simply went on with your own solutions in this area? Any comments on the auto-update topic welcome. TIA.

+3  A: 

Normally we use the third party tool. But in some situations it was not usable so I created an own solution, which was pretty standard:

  • Get xml (or any other format) with update info.
  • If newer files are published, download and install them.
Gamecat
+3  A: 

I created my own solution too based on Indy for downloading and http://sourceforge.net/projects/makeupdate/ for file patching. Before that I have used and tried several commercial tools, but no one was doing exactly what I needed.

+7  A: 

Years ago I wrote a simple tool which is started instead of the real program, checks for updates, loads and installs them (if any are available), and finally starts the real application.

There are however problems with that approach if your program works in a properly administered environment, where users normally don't have write access to the program directories. You can no longer simply update your own program in such environments. That's why a lot of programs these days come with their own updater tool, which can be installed to run with elevated permissions, so that program updates can be applied even though only standard users do ever log on to the system.

You have to decide whether your target audience can be assumed to run on power user or administrator accounts, or whether you will have to deal with above-mentioned problems. With Vista things got considerably harder already.

With all these problems (net access over proxies, missing write permissions for installation directories, the need to update files that the updater itself is using - just to name a few) I wouldn't try again to code this on my own. Much better to check if any one of the available solutions does all you need it to.

mghie
+4  A: 

I use the Synapse routines GetHTTP to return a specific resource, and if found then check against the local system to see if an update is required. If so then the resource tells me what page to go to launch and I throw the URL into shell execute so the users preferred browser is displayed.

Most of the time the download is a setup program created by InnoSetup which updates the users system and database to the latest version. When a new "paid" upgrade is needed, I then send the user to a "purchase upgrade" form. My web resources are ASP pages, so I can redirect to a different resource based on the customers version number.

For the main application (our application has a server piece, and a client piece) I have a loader which will check the server to see if the version of the client file on the server is different than the version on the client...if so, it prompts the user if the user wants to update/revert. We chose to prompt the user as sometimes an accidental bug might make it into the system and the user has to downgrade/upgrade only specific machines to help troubleshoot. I maintain a database record with the minimum version required which is updated via the database patch, so if a version must be retired then the record is updated accordingly.

skamradt
+7  A: 

What ever scheme you use, it may be handy to know that you can actually rename a running .exe file. So rename file, copy in new file works nice. And the next time someone launch the program they will launch a the new version. This is ofcourse very handy in enviroment where many users run the same .exe file, like in citrix/terminal server/network share cases.

Tom
+2  A: 

I use TWebUpdate . It works ok and has a ton of interesting options, but documentation isn't so great and I did bump into a few problems - which is why I download a full installer, instead of just the files...

I will be keeping an eye on this question, btw...

stg
I use TWebUpdate, too. stg says it all - it works, but the docs could be a LOT better. The online support via their newsgroups and support email is good, however. It's cheap enough that you can afford to try it out and see whether it's good enough while you're adding other functionality.
GuyWithDogs
+1  A: 

I use TmxWebUpdate. It's free, simple and gives you good control over the process. I actually own TMS Component Pack with TWebUpdate but never really found a good reason to switch.

vrad
+1  A: 

Same as "stg" and "GuyWithDogs", I'm using TWebUpdate from TMS. Although the documentation isn't so great, Its not so difficult to learnt.

With TWebUpdate, you have some options what the protocol you use, it could be done via HTTP, FTP or network access.

For communication layer, TWebUpdate uses WinInet. In some machines, the windows / IE URL cache can be frustating, so I've added a routine to clear the auto-update server address from cache first to ensure the information gathered from the server is up-to-date.

bprasetio
+1  A: 

We rolled our own as well. Its really not too difficult.

Our process goes something like:

  • When the main app is launched, it checks (using funcs from the synapse library) if there's an update available (assuming its configured to check, of course).

  • If so, it notifies the user and askes if they want to update.

  • If they do, it launches an updater .exe, and closes the main app.

  • The updater exe downloads the new files based on the contents of a text file it retrieves, keepiing the files in memory.

  • When the updater is done downloading everything correctly, it then saves the downloaded files to disk, backing up any files it replaces. This way if the download gets interupted, you dont end up with half the files installed.

  • Finally, it launches the main app again, and closes itself.

The trick w/ Vista is that you need to have an entry in the updater program's manifest to force it to run with administrator rights.

GrandmasterB
+1  A: 

We use our own solution which follows these steps:

  1. Application connects to http resource and downloads info file (ini text file) to memory, checks version number of newest release.
  2. If newer version available, app downloads compressed binary package to exe location.
  3. When download is finished, user is asked to restart application.
  4. Upon start, application checks for presence of update package
  5. App extracts package contents (usually a new app exe, but additional resources possible as well, e.g. updated language files etc.) - for each file it renames the current/old file to a temp name first, then extracts the new file. If the process fails at any point, the temp files are restored.
  6. When finished, app executes new exe and closes itself.

No additional updater needed, the app exe can handle it all by itself.

For the compressed package we use our own update builder. The package contains an index of files with a file hash, destination folder (relative path to main exe) and the compressed files. During update we compare the stored hash with the extracted file to detect corupted files.

With Vista I see two solutions to enable Standard User Accounts to actually update the applications files:

I. Configure your setup to change permissions of the programs installation directory. This way files in "C:\Program Files (x86)\Your Company\You App" can be modified on Accounts with limited rights.

Example code for InnoSetup would be:

[Dirs]
Name: "{app}"; Permissions: users-modify

II. Install files that you plan to update to the ProgramData folder instead of the user defined directory and use this directory as an override folder. If files exist in ProgramData, use those, else check in install dir.

InnoSetup code:

[Files]
Source: "C:\Your Project\YourApp.exe"; DestDir: "{commonappdata}\Company Name\App Name\"; 
BlackOut