[ Team LiB ] |
2.3 Shared AssembliesAssemblies can be private or shared, as illustrated by Figure 2-3. Each application that uses a private assembly has its own copy, which is stored alongside the other application components. If there are two applications installed on the same computer, and each application relies on the same private assembly, then there will be two copies of the assembly files installed. Each time you install a new application that relies on the private assembly, you create new instances of the assembly files on disk. Each assembly is independent of the others, and each application is completely self-contained. Figure 2-3. Private and shared assembliesBy contrast, several applications can use a single instance of a shared assembly. The assembly is placed in a common location (a shared directory or network server), and every application that requires the assembly uses the same assembly disk files. More than one copy of a shared assembly can be installed, and groups of applications can rely on different instances, as illustrated by Figure 2-4. Figure 2-4. Groups of applications relying on multiple identical private assembliesThe .NET Framework also provides the Global Assembly Cache (GAC), which is a central repository for shared assemblies. All applications that rely on a shared assembly stored in the GAC use the same disk files, as illustrated by Figure 2-5; such applications do not need to be configured to find shared assemblies in specific locations; the GAC is always available to all applications. See Section 2.5.1 for further details. Figure 2-5. The GAC hosts shared assemblies
The benefits of sharing an assembly are administrative—the assembly security policies and configuration that we discuss in the following chapters are applied to a shared assembly once, affecting all of the applications that rely on the assembly, whereas each instance of a private assembly must be configured individually. |
[ Team LiB ] |