Relating to Can I make the default AppDomain use shadow copies of certain assemblies?, it describes a working solution to activate shadow copying within the default AppDomain for a specific directory.
Basically it says to use these simple methods:
AppDomain.CurrentDomain.SetShadowCopyPath(aDirectory);
AppDomain.CurrentDomain.SetShadowCopyFiles();
But because the methods used here are marked as obsolete I was wondering what is now the correct way to accomplish the same. The warning message hints to:
Please investigate the use of AppDomainSetup.ShadowCopyDirectories instead
An AppDomain has a member of this type called SetupInformation
which might bring you to this straightforward implementation
AppDomain.CurrentDomain.SetupInformation.ShadowCopyDirectories = aDirectory;
AppDomain.CurrentDomain.SetupInformation.ShadowCopyFiles = "true";
Unfortunately this has no effect. So the question is, is there a way to alter the AppDomainSetup of the current appdomain to activate shadow copying ?
SetupInformation
creates a clone of the internalFusionStore
property which in turn is a reference to the actualAppDomainSetup
used to initialize the current domain. The idea is that after initialization, these properties cannot be modified anymore (though I wonder why they haven't made them gettor-only to signify that). – Suzette