Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why are not all assemblies in GAC built as MSIL?

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\

enter image description here

Why is System.Data built for two different processor architectures, while System.Core is MSIL?

C:\Windows\Microsoft.NET\assembly

enter image description here

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.

like image 487
B.K. Avatar asked Jan 11 '15 23:01

B.K.


People also ask

What is GAC MSIL?

GAC Folder The folder path used by .NET Framework 4.0 (and above) is C:\Windows\Microsoft.NET\assembly\GAC_32 (32 bit only) C:\Windows\Microsoft.NET\assembly\GAC_64 (64 bit) C:\Windows\Microsoft.NET\assembly\GAC_MSIL (32 and 64 bit) The MSIL is an abbreviation for Microsoft Intermediate Language.

Which type of assembly should be installed in GAC?

To install an assembly in the GAC, you must give the assembly a strong name. The name is a cryptographic hash-key, or signature. This strong name ensures correct component versioning.

Which assemblies are stored in GAC?

All assemblies provided by Mono are stored in the GAC.

Where is GAC MSIL folder?

The 4.0 GAC is at C:\Windows\Microsoft.NET\assembly . You'll find the various types of assemblies divided up into their 32-bit, 64-bit, or MSIL subdirectories under that folder.


1 Answers

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.

like image 179
Jared Kells Avatar answered Sep 20 '22 08:09

Jared Kells