Meeting the needs of your business from a distance

Changing Code In A Running Application

by mark shiffer 4. September 2009 14:59

I ran across a blog entry that used an interesting manipulation of AppDomains to accomplish a live swap of code to be able to provide updates to an application while it is running. The full blog entry can be found here.

In brief, the author creates an AppDomain using the AppDomainSetup class to force ShadowCopyFiles to true. This particular flag allows you to load an assembly into the AppDomain without leaving a dependence on the physical file. So, later on, you can copy over that same assembly with a new version, use FileSystemWatcher to catch the file change and unload and reload the AppDomain. Pretty cool trick.

I’ve never had the need for it, but just in case I do in the future, I am documenting it here.

Tags:

Research | Programming

Comments

Add comment


(Will show your Gravatar icon)

  Country flag


  • Comment
  • Preview
Loading



Copyright © 2001-2012 MS Consulting, Inc. All Rights Reserved.