Microsoft Store on Windows can automatically install app updates. Select the Start screen, then select Microsoft Store. In Microsoft Store at the upper right, select the account menu (the three dots) and then select Settings. Under App updates, set Update apps automatically to On.
Updates fix any problems with software or hardware that were not detected before the product was released to the public. If you don't update, the computer could encounter those problems or be vulnerable to attacks.
You'll probably have to write your own. As FOR mentioned, the basic idea is to put the latest version of your program (I'm assuming an EXE) on the server, and then have your application check with the server when it starts, and download the EXE from the server if it's a newer version.
I've usually implemented this as a web service that the application calls at startup. A couple of warnings about this approach:
The web service method needs to get the version number of the EXE on the server and compare it to the version number of the caller. If you use the Assembly class to read the version number of the server EXE, this will lock the file for as long as the web service instance is running (at least 20 minutes). As a result, you may sometimes have trouble replacing the EXE on the server with a newer version. Use the AssemblyName class instead - this allows you to read the assembly info without loading the assembly (and locking it).
The caller application can't replace its own file with the new version - you can't delete or update a running application file. What it can do, however, is to rename its own file while running. So the trick on an auto-update is for the application to rename itself (e.g. "MyApplication.exe" to "MyApplication_OLD.exe"), download the new version into the application folder (named "MyApplication.exe"), notify the user that an update has occured which requires a restart of the application, and then end. When the user restarts the application, it will be the newer version that starts - this version checks for and deletes the old version.
Doing an auto-update that automatically restarts the application after an update like this is very tricky (it involves kicking off another process and then ending its own process before the auto-restart process kicks in). I've never had a user complain about having to restart the app.
Ok, first of all, if one of the installer/updater products out on the market fits your need, you should probably use those. That being said, I've had the pleasure of building a system like this myself not long ago. Yes, our installer/updater included two parts on the client side so that:
~ Part A would connect to the servers where the latest version is stored and published; if a newer version of Part B was available, it would download it and kick it off
~ Part B would focus on installing/updating the actual application (and could download and install updates to Part A).
Aside from that, I'd recommend always considering the following 4 operations in the installer/updater:
Install and Uninstall
Update and Rollback (i.e. undo the last update)
The Rollback one is critical when your users have a system that automatically updates overnight.. if an update every messes up, they can rollback and continue working while you fix the issue.
Finally, the installer/updater should try and be agnostic about the application it installs/updates, so that, when that application changes, the installer/updater system is impacted the least possible amount.
I coded an updater for an app I worked on in C++, but the general structure would be the same.
This worked pretty well for us, and as it always downloaded a new "updater" as the first thing it did, we could handle some funky new things that might not work otherwise.
Wrote our own automatic update software. So here's my tip... Don't do it!! Of-course this all depends on your specific scenario, but here are the problems that my company encountered:
The problem with our software is that we needed a lot of flexibility and support on all Windows platforms. The solution we wrote worked fine, but didn't scale and started to fail when Windows versions changed or weren't quite like those in our lab. We ultimately bought software and I recommend you do the same. If you are interested, we bought a product called AutoUpdate+ (link text).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With