Possible Duplicate:
How are DLLs loaded by the CLR?
In .NET are referenced DLLs loaded on demand at run-time? Or are they all loaded in the beginning. I ask because when running my project with Visual Studio attached, I notice that it is loading symbols for every DLL referenced at the start.
Is this only because I am running in debug with VS attached?
You can check yourself using Procmon (Process Monitor) while running without VS attached. Off the top of my head, I recall they are loaded on demand when the JIT compiler first meets a type. In fact, I work with a mixed solution (managed and unmanaged assemblies) and when an unmanaged dll is missing, the error appears when a type from that assembly is first needed; I even got the call stack for that when running on VS. But I never checked outside VS. As for the theory behind, there’s a long explanation in this question.