Forced Updates

We have a WinForm application that is installed on multiple PC's at a client's site. For varous reasons, all copies of the application at the site MUST be the same version. Also, we need to make changes to the database tables in addition to updating the application. Therefore, we don't want any automatic checking for updates or to have individual users loading updates. Instead, we need to use the following procedure:

1. All other users exit the application2. A "master user" selects the Update option from a menu. This runs application code that should: a. Update the database tables using a database syncing tool outside of WyBuild b. Force an update of the application using WyBuild c. Restart this application with the new version3. As each user starts the application again, a check is made on the database which determines that the application is out-of-date. The application should: a. Force an update of the application using WyBuild b. Restart the application with the new version

We don't want to use the AutomaticUpdater control, just force the WyBuild update process to run inside the application code. Any ideas as to how to make this work?

Run wyUpdate using command line switches...http://wyday.com/wybuild/help/wyupdate-commandline.php

There are many ways to do this. Here's the best way as I see it. Your app should detect (from a table in your database) when it needs to be forcefully updates. When that happens don't allow the user to run your app and either do 1 of 2 things:

  1. Launch wyUpdate to do standalone updating. See: How to Silently Check for Updates
  2. Or, use a Windows Service to do a completely silent update. See How to Silently update a Windows Service

If you haven't used wyBuild before, here's a good place to start: Walkthrough for your first time using wyBuild.

Tell me if this helps.

We have used WyBuild before, but always with the Windows Control used to do the update. However, as previously discussed, this will not work for the current project.For a GUI application silent update, your example appears to just launch wyupdate with the ShellExecute function, then exit the main application without waiting for wyupdate to complete execution. Is that what it does? If so, then how do we know when wyupdate completes execution, and if succeeds or fails? Also, how do we restart the main application once wybuild completes updating the application?

For a GUI application silent update, your example appears to just launch wyupdate with the ShellExecute function, then exit the main application without waiting for wyupdate to complete execution. Is that what it does? If so, then how do we know when wyupdate completes execution, and if succeeds or fails? Also, how do we restart the main application once wybuild completes updating the application?

That's why creating a dummy service that does the updating in the background is probably a better choice for your needs.