Dynamically loading assemblies
The reflection services allow you to load an assembly at runtime. This is done using the System.Reflection.Assembly
type, which provides various methods for loading assemblies.
Assemblies can be either public (also called shared) or private. A shared assembly is intended to be used by several applications and is usually located under the Global Assembly Cache (GAC), a system repository for assemblies. A private assembly is intended to be used by a single application and is stored in the application directory or one of its sub-directories. Shared assemblies must be strongly named and enforce version constraints; these requirements are not necessary for private assemblies.
An assembly can be loaded in one of three contexts or without any:
- The load context, which contains assemblies loaded from the GAC, the application directory (
ApplicationBase
of the app domain), or its sub-directories of private assemblies (PrivateBinPath
of the app domain...