Link to home
Start Free TrialLog in
Avatar of ktola
ktola

asked on

Automating WinForm Upgrades

I have a WinForms SysTray application that is installed using an InstallShield project downloaded from a web server.  The application itself can communicate with the web server and I want to utilize this communication to notify people of upgrades, download said upgrade and run the new installer automatically.

The upgrade process itself works just fine - but people have to manually log into my site, download and install it,  Is there a way that I can make the Windows application do this for the user?
Avatar of Todd Gerbert
Todd Gerbert
Flag of United States of America image

Seems like it shouldn't be too difficult...

Create a page on your web server that serves a simple text file that includes the most current version number, the URL to download the current version, and optionally a URL clients should use in the future to check for updates.

You could use a WebClient or HttpWebRequests in your forms application to get the text file, determine if a newer version is available, and download it.

Then use Process.Start to run the installer.
ClickOnce was developed exactly for this purpose. Instead of using a third party installer, you'd create your project as a CO project. There are, of course, requirements that you have to configure and meet, but once set up, when you push a new version to a public URL, previously installed instances will automatically see the update. You can also control whether they must take updates, etc. It's quite powerful and simple ... once you get through the requirements. I haven't tried wrapping a system tray application in CO, so I'm not sure whether it's possible or not.
I have a sys tray app I've deployed with ClickOnce, so it definately works - but that's internal to my company, on our intranet - I'm not sure ClickOnce necessarily lends itself well to deploying anything other than a very simple application.  Certainly something to consider though.
Avatar of ktola
ktola

ASKER

I was looking for some automated hooks through InstallShield but that does not appear to be an option.  The access permissions I need preclude using ClickOnce so that is not an option.  I had already written out the manual process but it does not allow for a smooth restart of the application and getting the application to shutdown before the installer kicks in is tricky at best...
In that case, I suspect the first response is your best option ... some mechanism so have the app look at a simple "flag" in a public place and then let the user know. At least it's a good start.
ASKER CERTIFIED SOLUTION
Avatar of Todd Gerbert
Todd Gerbert
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ktola

ASKER

What I wanted to do does not exist and, since I have to run in admin mode, auto-starting does not work either.  I ended up writing a routine that performs a binary download of the new installer, launches said installer and then closes the main application.  While not ideal, this appears to be sufficient for the current requirements.