We have a minimal 'updater' exe that checks a remote URL for updates, downloads them and replaces files on disk prior to launching the real application. However if we want to replace the updater EXE then AFAIK we have two options:
Shadow Copying Assemblies whereby .Net will create a shadow copy of the EXE (and any referenced assemblies) and load those assemblies, such that the non-shadow assemblies can be replaced and will be used when the application is next launched.
Identify which files are replaced and rename/move them on disk. Windows seems to allow the renaming/moving of locked files, so we can move the files and copy in the new assemblies. Again, on next launching the application we will be launching the new assemblies. This approach is mentioned here
Is this second method a recommended method? Are there any pitfalls to this approach?
For example, provide criteria that retrieves all security or critical software updates that are required on more than 50 clients. Create a software update group that contains the software updates. Download the content for the software updates in the software update group. Manually deploy the software update group.
It's generally better to keep auto-updates on so that you can get a timely security fix in case there's a vulnerability found in an app you're using—but whether you should enable or disable auto-updates comes down to personal preference.
If the automatic update feature is enabled, your applications get updated without being asked, so you may not realize that large volumes of data are being downloaded. You can disable the automatic update feature to avoid potentially high data transfer costs.
Updates can prevent security issues and improve compatibility and program features. Software updates are necessary to keep computers, mobile devices and tablets running smoothly -- and they may lower security vulnerabilities. Data breaches, hacks, cyber attacks and identity theft have all been in the news.
Another option: when the main application wants to update itself, it spawns a new updater process and then closes itself. The spawned process in the meantime waits for the main application to close (the process to disappear) and then updates all of the necessary files (including the .exe). After that it simply restarts the main application and exits the updater process.
Im using the second method without any problems. Just make sure the downloaded assembly was correctly downloaded. ;)
Run Update.exe and let it do this:
Im doing this with no problems at all so its tested and are running in live environment in about 400 customers as we speak.
What about ClickOnce deployment?
In a project i worked on, there where 2 executables. Let's call them A and B.
The only reason A existed was to start B. So, when B (the 'real' application) downloaded an update, it was able to replace A if neccesary.
If the application was restarted (via A), A checked if B downloaded some files and replaced them before it started B.
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