So I have this windows .net form app, and I have the following goals:
-Needs to be 1 single file, the executable, in any directory the user decides to download it to. No installation folder, no launcher/updater app, no registry entries.
-App to automatically check for updates, ask permission from user, update app, and relaunch.(if necessary)
I've never done this before, so I don't know the correct way to go about this, and my current idea is this:
1) Launch app, check a webservice for updates. If app is up to date, or if app does not receive a response fast enough, or if there is an exception, or if user selects not to update, continue launching app like normal.
2) If app is out of date and user selects to update, download 2 applications from webservice. Lets call them newForm.exe and updater.exe. Since I don't know what filenames will exist in the app's directory, they'll be named something random until they're confirmed to not overwrite anything.
3) "updater.exe" will be executed and passed the current app's filename as well as the new "newForm.exe" app's filename.
4) updater.exe closes all threads and processes of the current app, then deletes the current app executable.
5) updater.exe renames newForm.exe to whatever the original app's filename was, and then executes newForm.exe, passing along updater.exe's filename.
6) newForm.exe is now the current app, only now its updated. If it is launched with updater.exe's filename as an argument, deletes updater.exe. And then it should just be the updated standalone form, I think.
Like I said, I've never attemped auto-updating before, but with this current app, user convenience is the highest priority. These users have a history of never updating anything because they can't be arsed to read their email, and they hate installing things. Im seriously considering not even asking them if they want to update and just force it down their throat. Questions:
Is this approach silly/ridiculous and done better in a much simpler way?
Will this approach work, or will windows/firewalls/anti-virus programs get in the way and mess it all up?
Any help, tips, and advice are much appreciated!
|