.NET Assembly Introduction

.NET Assembly Introduction

Assembly(Global Assembly,GAC – Global Assembly Cache ‘Jack’)

Strong Naming, Shared Assembly , Meta Data  -vs- Manifest

Application Tools

[C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin]


ildasm.exe          – MCL/MSIL DeAssembler Tool

sn.exe                  – Strong Naming Utility Tool

GacUtil.exe        – GAC Utility Tool

.NET Inter-operability Tools [used for migrating from ASP to ASP.NET]

AxImp.exe – ActiveX Importer Tool

TlbImp.exe- Type Library Importer Tool


The Final output created after twice-compilation of all source codes[*.cs]. With respect to Program Access,  Assembly can be classified into two-types:

1. Private Assembly: The Assembly which should be kept in \Bin folder of the application is known as ‘Private Assembly‘. A private assembly is usable within one application only. A default assembly created is always a ‘private assembly’.

2. Shared Assembly: A shared assembly can be used by multiple applications within the server, without copying to every \Bin folder of the applications.   All shared assemblies are LISTED at c:\Windows\Assembly as a part of Global Assembly Cache[GAC]. A private assembly can be converted into ‘Shared Assembly‘.

Creating a Shared Assembly:

A private Assembly MUST be

• ‘Strong Named’ first and then

• Installed with GAC, using GacUtil.exe to convert into ‘Shared Assembly’.

Step – I

Generate Strong-Naming Key Pair[B115.snk]

Key Pair

– Private Key [Non-shareable]

– Public Key [Shareable]

DOS>sn  -k  B115.snk[enter]

Step – II Add the Strong-Naming Key Pair as Meta-Data in AssemblyInfo.cs.


using System.Reflection;

using System.Runtime.InteropServices;

– –  –


Step – III: Create the strong-Named Assembly, by compiling[Re-Build, F6] all the source code.

Step – IV Installing the strong-named assembly into GAC. GacUtil.exe

DOS>gacutil  /i    c:\B115\Bin\MyAppB115.dll[enter]

– Listing will be available at  C:\Windows\Assembly\

To see the LISTING of GAC

DOS>gacutil /l   [enter]

To add any new class[.cs] file or updating any source-code of the assembly, First the assembly MUST be un-installed from the GAC. Then change code / add .cs file, re-compile and add to GAC again.

For un-installing a shared assembly

DOS>gacutil /u   MyAppB115[enter]

Global Assembly: Microsoft Provided all ‘shared assemblies’ as a part of .NET Framework are known as ‘Global Assembly’.

All Global Assemblies are available at CLR folder(s).

All these assemblies are listed in GAC.

Listing at C:\Windows\Assembly  folder.

mscorlib.dll         // Base Assembly

System.Data.dll                – Namespaces, System.Data, System.Data.Sql, System.Data.SqlTypes, System.Data.Common, System.Data.OleDb, System.Data.Odbc, System.Data.SqlClient Namespaces

System.Data.OracleClient.dll          [Add reference]

– System.Data.OracleClient Namespace

Meta Data and Manifest: Meta Data : Vital information about the assembly like Company Name, Application Title, Application Name, Trademark, CopyRight, VERSION  [MUST], Public Key Token [Strong Naming] etc.

All meta-data MUST be written into an AssemblyInfo.cs file as attributes.

After twice-compilation, all meta-data will be kept in an Assembly as ‘MANIFEST’.

The manifest of an assembly can be viewed using ILDASM.exe.

Thanks for your attentions

Ref: Md. Sadiq Sir

Related links:

Understanding and Using Assemblies and Namespaces in .NET

Introduction to IL Assembly Language

The .NET Framework – What is a .NET Assembly


* .NET Assembly Introduction


Hi, This is R K Gupta, an IT professional and Entrepreneur. I have written many articles yet for my websites gsesoftsolutions.com, Hope you like it. Kindly subscribe our feed for any updates. Add me in Facebook and Google+

Posted in Microsoft .Net Help, Software Development