DotNet FrameWork – Shared Assemblies – Global Assembly – MSIL – Day 19 of 30

How do you create shared assemblies?

Just look through the definition of Assemblies..

*  An Assembly is a  logical unit of code

* Assembly physically exist as DLLs or EXEs

* One assembly can contain one or more files

* The constituent files can include any file types like image files, text files etc. along with DLLs or EXEs

* When you compile your source code by default the exe/dll generated is actually an assembly

* Unless your code is bundled as assembly it can not be used in any other application

* When you talk about version of a component you are actually talking about version of the assembly to         which the component belongs.

* Every assembly file contains information about itself. This information is called as Assembly Manifest.

Following steps are involved in creating shared assemblies :

* Create your DLL/EXE source code

* Generate unique assembly name using SN utility

* Sign your DLL/EXE with the private key by modifying AssemblyInfo file

* Compile your DLL/EXE

* Place the resultant DLL/EXE in global assembly cache using AL utility.

What is global assembly cache?

Each computer where the common language runtime is installed has a machine-wide code cache called the global assembly cache. The global assembly cache stores assemblies specifically designated to be shared by several applications on the computer.

There are several ways to deploy an assembly into the global assembly cache:

· Use an installer designed to work with the global assembly cache. This is the preferred option for installing assemblies into the global assembly cache.

· Use a developer tool called the Global Assembly Cache tool (Gacutil.exe), provided by the .NET Framework SDK.

· Use Windows Explorer to drag assemblies into the cache.

What is MSIL?

When compiling to managed code, the compiler translates your source code into Microsoft intermediate language (MSIL), which is a CPU-independent set of instructions that can be efficiently converted to native code. MSIL includes instructions for loading, storing, initializing, and calling methods on objects, as well as instructions for arithmetic and logical operations, control flow, direct memory access, exception handling, and other operations. Before code can be run, MSIL must be converted to CPU-specific code, usually by a just-in-time (JIT) compiler. Because the common language runtime supplies one or more JIT compilers for each computer architecture it supports, the same set of MSIL can be JIT-compiled and run on any supported architecture.

When a compiler produces MSIL, it also produces metadata. Metadata describes the types in your code, including the definition of each type, the signatures of each type’s members, the members that your code references, and other data that the runtime uses at execution time. The MSIL and metadata are contained in a portable executable (PE) file that is based on and extends the published Microsoft PE and common object file format (COFF) used historically for executable content. This file format, which accommodates MSIL or native code as well as metadata, enables the operating system to recognize common language runtime images. The presence of metadata in the file along with the MSIL enables your code to describe itself, which means that there is no need for type libraries or Interface Definition Language (IDL). The runtime locates and extracts the metadata from the file as needed during execution.

Please read all the post in the Dotnet Framework series.

Reference : Dilip Kumar Jena ( )


3 thoughts on “DotNet FrameWork – Shared Assemblies – Global Assembly – MSIL – Day 19 of 30

  1. Pingback: DotNet FrameWork – Dot Net Basics Complete Series Reference – Day 0 of 30 « Exploring Dot Net with Dilip Kumar Jena

  2. Pingback: nostradamus code | dutch subtitles | Nostradamus | Nostradamus Future Predictions

  3. Pingback: Common Language Runtime « .NET Framework

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s