Auto update for WinForms application

AnonymousCow picture AnonymousCow · Sep 26, 2008 · Viewed 49k times · Source

When creating an auto updating feature for a .NET WinForms application, how does it update the DLLs and not affect the currently running application?

Since the application is running during the update process, won't there be a lock on the DLLs (because those DLLs will have to be overwritten during the update).

Answer

Phil Wright picture Phil Wright · Sep 26, 2008

Usually you would download the new files into a separate area. Then shutdown and restart and at startup you look for and use the new files if found. Always keeping a last known working version on the side so that the user can revert to something that definitely works if the download causes problems.

ClickOnce is a good technology from Microsoft that does this for you and you can use it directly from Visual Studio 2008.