Solved

Automating WinForm Upgrades

Posted on 2011-02-15
7
422 Views
Last Modified: 2012-06-27
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?
0
Comment
Question by:ktola
  • 3
  • 2
  • 2
7 Comments
 
LVL 33

Expert Comment

by:Todd Gerbert
ID: 34898545
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.
0
 
LVL 16

Expert Comment

by:ToddBeaulieu
ID: 34898883
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.
0
 
LVL 33

Expert Comment

by:Todd Gerbert
ID: 34899407
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.
0
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 

Author Comment

by:ktola
ID: 34899517
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...
0
 
LVL 16

Expert Comment

by:ToddBeaulieu
ID: 34899536
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.
0
 
LVL 33

Accepted Solution

by:
Todd Gerbert earned 500 total points
ID: 34899706
>>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...

How so?  I assume there's a menu of some sort on your application, and probably with an "Exit" option, so your download routine could just use Process.Start to launch the installer for the update and then immediately run whatever code you already have in place to handle a a request for exiting the application.

Alternatively, you could store the update in a "special" folder and just advise the user they need to restart the application for the update to run - then modify your application to check for the presence of an MSI in this folder on startup and run it if present.
0
 

Author Closing Comment

by:ktola
ID: 34943534
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.
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now