实施自我更新软件的最佳方法 [英] Best method for implementing Self-Updating Software

查看:119
本文介绍了实施自我更新软件的最佳方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个最小的"updater" exe,它可以在启动真实应用程序之前检查远程URL的更新,下载更新并替换磁盘上的文件.但是,如果我们要替换更新程序EXE,那么AFAIK我们有两个选择:

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. 阴影复制程序集. EXE(和任何引用的程序集)的影子副本并加载这些程序集,以便可以替换非影子程序集,并在下次启动该应用程序时使用它.

  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.

确定要替换的文件,然后将其重命名/移动到磁盘上. Windows似乎允许重命名/移动锁定的文件,因此我们可以移动文件并在新程序集中复制.同样,在下次启动该应用程序时,我们将启动新的程序集.在此处

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?

推荐答案

查看全文

登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆