Can a .NET application update itself in the background like Google Chrome?
Google Chrome updates itself in the background. No user action is required. I find this to be a very good and user-friend开发者_StackOverflow社区ly 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?
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 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.
精彩评论