What does ShadowCopyFiles property in appdomain does?

给你一囗甜甜゛ 提交于 2019-12-12 10:38:53

问题


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?


回答1:


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).



来源:https://stackoverflow.com/questions/2687166/what-does-shadowcopyfiles-property-in-appdomain-does

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!