What is the reason that not all of the assemblies in the Global Assembly Cache (GAC) are built as MSIL
? I see x86
and AMD64
architecture types used for some assemblies, as in the example below, but not for others:
C:\Windows\assembly\
Why is System.Data
built for two different processor architectures, while System.Core
is MSIL
?
C:\Windows\Microsoft.NET\assembly
A similar pattern can be seen under the second version of GAC, shown above. Assemblies are split into different architectures, but not all of them are built into 32/64
versions -- some are just MSIL
.
When you compile your library you can choose to target either "Any CPU" or a specific processor architecture.
The "Any CPU" libraries only need a single entry in the GAC and the entire assembly is compiled to MSIL.
Other assemblies need a different library for each architecture. These libraries are built for each CPU type and there are multiple copies in the GAC. The most common reason is to include unmanaged code or load a native dll which is architecture specific.
In your example System.Core is probably fully managed code whereas System.Data is probably built on top of a bunch of native windows libraries.
Applications running in 32bit mode will load the 32bit version of the library whereas applications running in 64bit mode will load the 64bit version.