What is an Assembly ?


  • Assemblies are the building blocks of .NET Framework Applications.
  • It is the fundamental unit of deployment, version control, reuse and security.
  • An assembly is a collection of types and resources that form a logical unit of functionality.
  • Assemblies can be static or dynamic.
  • An assembly can consist of one or more files.


Note--Assemblies are created during compile time rather than run time which is .DLL File.



Types of an Assembly


There are two types of an Assembly:


  1. a. Private Assembly
  2. b. Shared Assembly


1. Private Assembly


It is a Assembly which is used by single Application. It is created during compile time. Private Assembly is also called .DLL(Dynamic-link Library). DLLs provide a mechanism for shared code and data.



2. Shared Assembly


Shared Assembly is used by multiple Applications. Shared Assembly is also called .EXE(executable). To make .DLL shareable, you can keep .DLL into a folder called Global Assembly Cache.



What is Assembly Elements ?


Assembly can consist of four elements:


  1. a. The assembly manifest
  2. b. Type metadata
  3. c. MSIL code
  4. d. A set of resources


a. What is assembly manifest ?
  • Assembly manifest contains assembly metadata. It stores information about an assembly. It contains a collection of data that describes how the elements in the assembly relate to each other. It describes versioning, scope information and the security required by the Assembly.

b. What is Type metadata ?
  • Type metadata is a self-describe. It is a information that describe every element managed by the common language runtime.

c. What is MSIL code ?
  • It is a Microsoft Intermediate Language. Both Metadata and MSIL together wrapped in a Portable Executable (PE) file. During the runtime of a program JIT compiler of the CLR uses the Metadata and converts MSIL into native code. When code is executed, the runtime loads metadata into memory.

d. What is Resources ?
  • A Resource is any nonexecutable data that is logically deployed with an application. A resource might be displayed in an application as error messages or as part of the user interface. Resources can contain data in a number of forms, including strings, images, and persisted objects. Storing your data in a resource file allows you to change the data without recompiling your entire application.


Assembly Manifest Contents


There are four Contents - the Assembly name, Version number, Culture, and Strong name.



a. What is Assembly name ?
  • A text string specifying the assembly's name.

b. What is Version number ?
  • A major and minor version number, and a revision and build number. The common language runtime uses these numbers to enforce version policy.

c. What is Culture ?
  • An assembly with culture information is automatically assumed to be a satellite assembly.

d. What is Strong name ?
  • Using Strong name, Two or more assemblies are different to each other.


Some other Interview related Questions:



  • What is CLR ?

    • CLR is Common Language Runtime. It is an Execution Engine. It provides runtime Environment used to convert the MSIL Code to native code or machine code. It support manage code. The main role of CLR is that it manages Thread executions, Memory Management - deallocation of Objects, Garbage Collection (GC) - Clean up the unused Objects and Exception Handling etc.

  • What is Global Assembly Cache ?

    • The Global Assembly Cache (GAC) enables you to share assemblies across several applications. It is a single folder within bin directory. The Users can create manually this folder and keep all dll file here. So that multiple applications can reuse them.

  • What is Satellite assemblies ?

    • A .NET Framework assembly containing resources specific to a given language is called as satellite assembly. Satellite assemblies is used If you want to localize your assembly. It containing resources specific to a given language. You can place resources for different languages in different assemblies using Satellite assemblies. Satellites must be stored in subfolders under the application folder. A satellite is associated with an assembly called the main assembly. That assembly lib.dll will contain the neutral resources.

  • What is Strong Name ?

    • Using Strong Name, Each Assembly can identify uniquely. It means two or more Assembly are not simillar to each other. When we assign .dll to public key token it is called Strong Name.

  • What is Namespaces ?

    • Namespaces are large collection of several different classes. It is logical grouping of types. In Namespaces, All Classes are organized in a hierarchical tree. System Namespace is the main root namespace to other classes. The main role of Namespaces are - Logical grouping of classes, Reuse of classes in application from COM component. provide interoperability between .NET application and COM component.

  • What is JIT Compiler ?

    • It is Just In Time Compiler used to convert MSIL code to native or machine code with the help of CLR. It is a part of CLR.

  • What is CTS ?

    • CTS is Common Type System. It is also a part of CLR. It define how to declare Data type such as value type or object type. It is responsible for cross language integration. It ensure that objects written in different .Net languages can interact with each other.

  • What is CLS ?

    • CLS is Common Language Specification. It ensures complete interoperability among applications. It is a subset of Common Type System. Using CLS, We can write .Net applications in different languages.

  • What is Garbage Collection ?

    • Garbage Collection is in-built or predefine mechanism for releasing unreferenced objects from the memory that is no longer needed that objects in the program). This is called Garbage Collection (GC). Garbage Collector has Finalize method and Destructor. It works when any new object is created.




  • Back to Top