Quantcast
Channel: Common Language Runtime Internals and Architecture forum
Viewing all articles
Browse latest Browse all 1710

Shadow copying within a multidomain application

$
0
0

Hello,

i have a program that loads modules in the form of unreferenced assemblies in separate domains. This was done so that modules can be loaded and unloaded like extensions or addons. I wanted to use shadow copying to allow users to update the addons while the program was launched, or even the program itself. However there is a small problem : the application is not shadow copying anything.

The application is a WPF program using .NET 4.5.1.

I have found the following page explaining how to set a domain to shadow copy :

http://www.codeproject.com/Articles/29961/Shadow-Copying-of-Applications

And adapted it for my purpose :

//Create domain with base directory in assembly directory
//Activate shadow copying so files can be edited while they are used
AppDomainSetup s = new AppDomainSetup();
s.ApplicationName = Path.GetFileNameWithoutExtension(path);
s.ApplicationBase = Path.GetDirectoryName(path);
s.CachePath = Path.Combine(Path.GetDirectoryName(path), "cache" + Path.DirectorySeparatorChar);
s.ShadowCopyFiles = "true";
s.ShadowCopyDirectories = Path.Combine(Path.GetDirectoryName(path), "sc" + Path.DirectorySeparatorChar);
_domain = AppDomain.CreateDomain(Path.GetFileNameWithoutExtension(path), null, s);

This is the code used to create domains for each module, but as i said, it doesn't seem to activate the shadow copying.

On this subject, i have 2 questions :

 - Why doesn't this code work as intended?

 - I haven't set up the application main domain to do the shadow copying yet, but it was my intention to do so. How would i be able to do so?


Viewing all articles
Browse latest Browse all 1710

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>