How to update an assembly for a running c# process (AKA hot deploy)?

It is easy to do. You can rename the file, Windows has a lock on the handle, not the directory entry for the file. Now you can just copy the update without problems. All that's left to do is to get rid of the renamed file after your app starts up again. If necessary.


I don't think this is possible. For example, when deploying asp.net applications with zero downtime, best practice is to have a load balancer so you can take down one instance, update it, then take down the other for update.


You can't update the assembly when it's in use. The best option for this type of situation is to make a small executable which does a shadow copy of your assemblies, and launches them from a new location.

This way, when the user launches the program, you can shadow copy (locally) from the deployment site, which can always be overwritten.

Tags:

C#

Deployment