.netshadow-copy

Best method for implementing Self-Updating Software


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:

  1. 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.

  2. 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?


Solution

  • What about ClickOnce deployment?