Code Simplified – Viral Sarvaiya

Code Simplified – Viral Sarvaiya, Web Developer Friends, dot net Developer, Sql Server Developer

Posts Tagged ‘shared assembly’

Difference between Assembly and dll

Posted by Viral Sarvaiya on May 29, 2010

Whats the difference between Assembly and dll in .net.? This is the important question in any .net interview.So i thought of summarising the information which i gathered from various sources.


Assembly  contains meta data ,manifest,resource files.

Metadata:Classes,interfaces,base class,scope,properties.

Manifest:Assembly name,version,culture info, strong name,list of all files, type reference and reference assembely



-StrongName: Public/private key decryptyion/encryption correspondingly.

-digital certificate to assembly using signcode.exe :Gives details abt developers identity.

Type Identity:

Defing a type “Datastore” in 2 different assembly..Net framework can differentiate it.

Reference Scope:

-Gives info about its type and resources.

-Gives info abt other assemblies which it depends on.


Each assembly has a 128-bit version number that is presented as a set of four decimal pieces: Major.Minor.Build.Revision


Assemblies are the natural unit of deployment.

Assembly with different version can be present only in GAC folder which has the ability to differentiate diff version.

You cant add a file with 2 diff version in same project.Bcoz bin folder of the project will not have 2 files with same file name.

What’s the difference between private and shared assembly?

Private assembly is used inside an application only and does not have to be identified by a strong name. Shared assembly can be used by multiple applications and has to have a strong name.

Strong Name:

  • A strong name includes the name of the assembly, version number, culture identity, and a public key token.
  • The .NET Code Access Policy can be used to grant or restrict permissions to assemblies based on their strong name. In addition, the strong name can also be used programmatically to control access to resources.
  • It allows assemblies to have the same name, because the assemblies are identified by their unique information—not their name.

Steps in creatting strong name:

1. This scheme relies on a private key that is used for encryption and a public key that decrypts. To create a file containing this key pair, use the Strong Name command-line utility as shown here:

SN –k KeyFileName

SN –k  KeyLib.snk

2. [assembly: AssemblyKeyFile(“KeyLib.snk”)]

3.Add this KeyLib.snk to the project.

4.Gacutil /I gettimelibrary.dll

If this assembly is used in client projects.The public key token of the referenced assembly is stored in the manifest of the client assembly as a way to reference the target assembly.

To make this appear in add reference u need to do 2 things:


1.Create MY Assemblies  folder in above location

2.Give the path of ur dll file in value of a Default key.

Assembly Dll
An assembly  is the unit of deployment and security for managed code projects.  It is a .NET Component and can be used only in .NET managed applications.Compiled code at run time is an assembly and After compilation of the requested ASP.NET file is complete, the assembly is loaded into the application domain, allowing late binding.

Codes in APP_Code folder during compilation will become one assembly.

Assembly  present in bin can have either strong/weak Name and assembly in GAC Should have strong name.

DLL contains library code to be used by any program running on Windows. A DLL may contain either structured or object oriented libraries.

Dll is an assembly.


Posted in ASP.NET | Tagged: , , , , , , , , | Leave a Comment »

%d bloggers like this: