Reflection, ShadowCopyFiles

  • Thread starter Thread starter Fredrik Melin
  • Start date Start date
F

Fredrik Melin

Hi,

We have a ASP.NET project that is using Reflection to load plugin dll's.

When needed to update the .dll's some of them are locked to readonly (used
by the main dll).

I understand that creating a Appdomain with .ShadowCopyFiles = "true" would
solve it, but shouldnt this be inherited from the ASP.NET application
itself? (because as I understand that is always using a shadow copy?)

If not, does anyone have a sample in VB.NET how to call a function that
creates a new appdomain and loads a dll using reflection?

- Fredrik Melin
 
Yes, the app domain keeps a list of directories where it will use
shadow copy. Before using Asseembly.Load* you'll need to append to the
shadow copy paths used by your appdomain.

Something like:

AppDomain.CurrentDomain.SetShadowCopyPath(
AppDomain.CurrentDomain.SetupInformation.ShadowCopyDirectories +
";" +
"[CustomPath]"
);

HTH,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top