This article details how it works in .NET. Summary of key points:
There are several different ways to load assemblies in .NET. When creating a sample project, assemblies usually come from:
List of assembly links for a top-level executable project
Link building for reference projects
Dynamically loadable assemblies using runtime loading via AppDomain or Reflection loading
and
.NET automatically loads mscorlib (most of the System namespace) as part of the .NET runtime deployment process, which raises the .NET runtime environment in EXE applications, or some other runtime placement environment (hosted while running on servers such as IIS, SQL Server or COM Interop).
and
Links to dependent assemblies are not preloaded at application startup (by default)
Dependent assemblies that are not referenced by executable code never load
Dependent assemblies just in time load at the first link in the code
Once assemblies are loaded, they can never be unloaded, unless the application domain in which they are hosted is unloaded.
source share