.NET 应用程序可以像 Google Chrome 一样在后台进行自我更新吗?
Chrome 浏览器会在后台自行更新。无需用户执行任何操作。我发现这是一种非常好的且用户友好的更新应用程序的方式。有谁确切地知道这在技术上是如何完成的,以及是否可以为 .NET (WPF) 应用程序做同样的事情?
Google Chrome updates itself in the background. No user action is required. I find this to be a very good and user-friendly way of updating an application. Does anyone know exactly how this is done technically, and if you could do the same thing for a .NET (WPF) application?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
是的。您可以使用 ClickOnce 或可以使用卷影复制。
这是 ShadowCopying 的示例,具有良好的描述,其中显示了一个示例Web 服务器的技术,但相同的技术也可以应用于桌面应用程序。另一个很好的例子是此处。
Yes. You can either use ClickOnce or you can use ShadowCopying.
Here is an example of ShadowCopying with good description, which shows an example of a web server but the same technique can be applied to a desktop application. Another good example is here.
ClickOnce 是一个糟糕的解决方案,因为它不在后台执行此操作,它仅在启动时进行检查,并且会显着减慢启动时间。
另一方面,Chrome 在应用程序运行时定期检查,以静默方式下载更新,然后在您说“好吧,为什么不”时安装它。
从用户的角度来看,几乎没有延迟,而且事情一直在持续进行。
卷影复制将是您最好的选择。您需要编写一个定时事件,定期检查 Web 服务器是否有更新的组件,并根据需要下载它们。卷影副本是替代它们的方法。
设计模块化系统也将有所帮助 - 您可以设计它,以便核心区域可以独立更新,而不必下载应用程序执行中涉及的每个文件,从而减少最终用户每次下载应用程序时的负载更新。
对于更极端的解决方案,各个供应商都提供更新服务,例如InstallShield。
ClickOnce is a terrible solution, because it doesn't do it in the background, it only checks upon launch, and can significantly slow down launch time.
Chrome on the other hand checks periodically while the application is running, downloads the update silently, then installs it when you say "OK, why not".
There is very little delay from the user's perspective, and stuff just keeps on chugging.
Shadow Copy will be your best bet. You'll want to write a timed event that periodically checks a web server for updated components, and downloads them as required. The Shadow Copy is the way to replace them.
Designing your system for modularity will also help - rather than having to download every single file involved in the execution of your application, you could design it so that core areas can be updated independently, reducing the payload for the end user each time they download your updates.
For a more extreme solution, various vendors provide update services, such as InstallShield.