Question

Using System.AddIn, is there a way to load and activate an AddIn without locking the .dll file? I want to delete or override the file to load a new version of my AddIn.

The only way to unlock the file at this moment is shutting down the AddIn. But I need to keep it always alive for incoming calls (Async-service, yes, a nightmare).

Or maybe there's another way to update AddIns at runtime, and I'm not doing it right. I'd like to know wich can be the correct way to do this. Thanks!

Was it helpful?

Solution

What about the ShadowCopy functionality of the System.AppDomain class?

I haven't given it a try yet, but you could try the following:

  1. Create an AppDomainSetup.
  2. In the AppDomainSetup instance set ShadowCopyFiles to true.
  3. In the AppDomainSetup instance set ShadowCopyFilesDirectories to the directory path(s) that contain the assemblies you want to be able to ovewrite at run time. This could simply be the directory where the add-in assembly is located. You should experiment a bit.
  4. In the AppDomainSetup instance set everything else according to your needs.
  5. Use this overload of AppDomain.CreateAppDomain to create the new application domain.
  6. Load the add-in using this overload of AddInToken.LoadAddIn

You can find more info on shadow copying here. Also read this thread at System.AddIn Tools and Samples page at CodePlex.

OTHER TIPS

Once you load the new version, how would you expect handover to work?

Sounds like you need two add-ins: one (that you never change) to just receive and buffer incoming calls, and another (that you do change) to do the work of processing those calls. Then you can shut down and upgrade the processing add-in. The message-receiving add-in meanwhile can buffer the async calls until the new version of the processing add-in is up and running.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top