Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does ShadowCopyFiles property in appdomain does?

I know when you set to true ,it will shadow copy the files.But what does shadow copy mean and why we need to shadow copy files?

like image 250
Ybbest Avatar asked Apr 21 '10 23:04

Ybbest


1 Answers

Shadow copy creates a copy of the assembly you are referencing.

The reason for this is that .Net (more exactly Windows) cannot unload (some) assemblies within a process once loaded. Because of this you could never replace an assembly without shutting down the entire process because the file remains locked by the OS.

However if you have a shadow copy .Net actually uses that to load your classes you can replace the original .dll file and only the shadow copy (that nobody 'cares' about) stays locked.

This is especially important in some environments (e.g. a webserver where you obviously don't want to shut down the entire server just to run a new version of some web-application).

like image 189
Foxfire Avatar answered Sep 19 '22 11:09

Foxfire