Assembly is a fundamental unit of functionality in .NET that contains code and resources. It can be an EXE or DLL. An assembly contains metadata with information about the types and resources it contains. It also contains MSIL code that is executed by the CLR. Assemblies help address the "DLL hell" problem of conflicting DLL versions by assigning each assembly a strong name based on its contents and versioning information in the Global Assembly Cache.
2. What is Assembly:
Assembly is major feature of .NET framework.
.NET defines the concept of assemblies, which
are collection of types & resources that forms
logical unit of functionality.
It is a fundamental unit of version, control,
reusability and security.
An assembly is either DLL or EXE the forms a
part of applications.
It contains MSIL code that is executed by CLR.
3. Some important points related to
Assembly:
Every assembly contains version.
It contains interfaces and classes. They may also
contains Bitmap files etc.
Every assembly contains assembly metadata,
which contains information about assembly.
CLR uses this information at the time of executing
assemblies.
Assembly may be private which are used only by
applications to which they belongs or global
assemblies which are used by any application in
the system.
4. Parts of Assembly:
There are four parts of Assemblies:
Assembly Manifest: contains information's like
name, version, culture and information about
reference assemblies.
Type Metadata: Contains information about types
defined in assemblies.
MSIL: It contains MSIL code.
Resources: It contains files such as BMP, JPG or
any other files required by applications.
Note: An assembly that contains only resources called satellite
assembly.
5. DLL Hell Problem
DLL Hell refers to the set of problems caused
when multiple applications attempt to share a
common component like DLL.
The reason behind this issue was that version
information about the different components was
not recorded by system and window registry did
not support multiple versions of same
components. This is called DLL Hell problem.
6. Solution of DLL Hell problem
.NET framework provides operating system with
Global Assembly Cache(GAC).
This cache is repository of all .NET components
that are shared globally on particular machine.
When .NET component is installed onto machine
GAC looked at its version and provide a strong
name for the component.
The component is then registered to the
repository and indexed by its strong name.
So the is no conflict in the different versions of
components or DLL.