Reputation: 302
I have several small standalone programs that have an update. I have one updater, that can update them (there is no installer for the projects needed, it simply replaces the files).
But how do I update the updater itself? I see three solutions on my own, but what would be the best way?
1) How to update "updater"? (C#) The problem here is, i dont want to have in each of my small programs the updater included; another problem would be, that the updater can patch all applications, but in some cases a person gets one application and should not be aware of the others.
2) Downloading a second updater with the first one, starting the new updater, deleting first and renaming itself to match old shortcuts. Best would be, if its possible to have do a selfreplace (deleting itself when the new file is loaded and replace the old one by itself)
3) Creating a launcher for the updater, the launcher will never be updated, but can replace the updater. Seems a bit overkill to me.
All 3 solutions should work more or less, but maybe there is an easier way/ cleaner solution.
Upvotes: 1
Views: 430
Reputation: 2797
Without knowing any additional info, the absolute easiest and fastest way I can think of (if all of the computers that have these applications are on the same network) is to simply write a batch file that checks for the existence of each application on the local machine, and if it finds it, it pulls an "update" batch file for that application from a central location and runs it (then continue on for the other applications).
Something like this:
...
SET CentralLoc=\\CentralServer\Updates
...
IF EXIST C:\CompanyApplications\Application1 (
COPY %CentralLoc%\UpdateApplication1.bat .\
call .\UpdateApplication1.bat
)
...
Then you can just deposit new batch files (or EXE, or MSI, or any other) to update each application into that central location whenever new updates become available.
This batch file would essentially act as an "updater for the updaters" (option 3) but keeping it as simple and barebones as possible.
However, this is just my first take on it without knowing more about your problem. There are much better ways of doing it, especially if everything is on an internal company network (MSI deployments, infrastructure automation tools like Chef and Puppet, IT inventory tools that support bulk update pushes, etc); but the above is one potential way of implementing the whole thing in 15 minutes if that's what you need.
Adding the comment to my answer...
The next best way I can think of is to create a C# project for the updater application itself (the .exe of the updater application), but put the updater's LOGIC into a separate .dll file which comes bundled with the updater. The updater can then dynamically load the .dll when it starts up, and if there's an update for the DLL itself - it can unload it, grab the new DLL, and then re-load it, all at run-time without anything noticeable to the user. All of the actual updater logic would live in the DLL and can be updated at-will by simply having the updater replace its own DLL...
Upvotes: 1