Fog Creek Software
Discussion Board

Automatic updates

I'm working on a desktop app (not .NET) and I want it to periodically check my server to see if there are any updates.  Lots of programs do this now.  The steps I want:

1. Connect to server and check for update
2. Download update
3. Close app and install update
4. Reopen app

Now, I've got steps 1 and 2 working, but 3 is tricky.  I currently use an .msi file for the initial installation and was trying to just use another one of those.  Basically, the app would download the full install of the newer version.  The problem is that when I tried to execute the installer, it pops up a window saying that the older version must be uninstalled via the control panel first.

So, I can probably figure out some tricks with registry settings and whatnot to make this work, but is there an easier way?  Lots of apps do this, so there must be some standard process.  I've looked via google, but I haven't found what I'm looking for.

Anyone done this before?

David (
Thursday, April 1, 2004

have a separate download dll/exe, start that, if no updates go to normal exex

Thursday, April 1, 2004

How would that solve the need to uninstall?

David (
Thursday, April 1, 2004

Sounds like your MSI isn't setup right to do an upgrade. You'll have to solve that problem and then...

Regarding step 3 and 4, I think the typical way is the ShellExecute the msi file and then exit the application. The application process will be long gone by the time the MSI actually starts overwriting files. Step 4 is as simple as running the app at the end of the MSI.

Thursday, April 1, 2004

MSI files can be configured in various ways - as an upgrade or a new version, to require the previous version to be uninstalled first, to install over the previous version, to automatically uninstall the previous version, or even to install side-by-side, etc.

How you configure these options depends on the tool that you are using to create the MSI file, but you should be able to find it in the help file for the install build tool.

Philip Dickerson
Thursday, April 1, 2004

If you are using Visual Studio.NET to build your MSI, then you can follow these steps:

1. Select the the project (not the solution)
2. Click F4 to bring up the properties window. (Don't right click-->Properties, this brings up a different dialog)
3.  Change the Version property, which will then prompt you if you want to change the Product and Package Code. Click yes

Alternatively, you can just change the Product Code.

Now, when you install this MSI, it will just update the existing installation without prompting the user to un-install the previous version.

Hope that helps!

Mark Hoffman
Thursday, April 1, 2004

Yes, I should have mentioned that I'm using VS .NET's installer tools.

Thanks for the tip Mark, I'll try that.  I built the current installer project about 9 months ago and promptly forgot all the options and stuff.

Do you think I need to create two different installation projects, one regular one and one just for updates?  That's actually what I was going to try next if I didn't get some good advice here.

David (
Thursday, April 1, 2004

Ah yes, the version property.  I remember now a question I had about that long ago.  Is there an easy way to have that grab the version from the version resource of the main app?  My build scripts can update that resource when I'm doing a labeled build.  It would be nice if that set the installer at the same time.  I suppose I could edit the resource file of the installer project...  Hmm, I'll do some more poking around there.

David (
Thursday, April 1, 2004

OK, I've now found the info I need.  Thanks guys!  I just needed the proper terms to search on.

Like Mark said, it's just a matter of changing the ProductCode and Version.  I got that Uninstall dialog precisely because my numbers hadn't changed.

Now, I just need to work it into my build scripts.

David (
Thursday, April 1, 2004

*  Recent Topics

*  Fog Creek Home