IntroductionSome applications may need to update themselves periodically. Typically the applications which are designed to be highly extensible usually may update few modules and thus can get new capabilities and functionality dynamically, just like plugins. .Net applications can take advantage of loading updatable modules in separate AppDomain and unload them when update is available and reload them with updated assemblies. One problem that you may encounter is that the assembly files which are loaded gets locked and this prevents to replace them. If you are using separate AppDomain to load assemblies then solution is easier. You can enable shadow copy feature for AppDomain which actually makes copy of assembly before loading thus original assemblies remain unlocked and you can replace them while application is running. If you are not using separate AppDomain and you want to update the assemblies including your application exe, then you need to do some tricky things as explained in rest of the article.Background I wanted to basically run the application and let the application update its own exe and other assemblies from some remote location. This requires to start the application in such a way that it do not locks its assemblies as normally happens when application starts. If application can update itself distribution of application can be done from centralized location. I am not including any logic to download the assemblies in this article. Using the code I found two solutions for the problem as below:Solution one : Here I have used an additional application (i.e.Starter.exe) along with the main application.The Starter.exe should be present in application's start up directory. If you are downloading code then make sure that you copy the Startup.exe after building.
Read more: Codeproject
QR:
Read more: Codeproject
QR:
0 comments:
Post a Comment