Open In App

Assembly in VB.NET

Last Updated : 08 Jul, 2022
Improve
Improve
Like Article
Like
Save
Share
Report

Assembly is a single deployable unit and consists of the MSIL, metadata, etc. Assemblies can be DLL or .EXE. Assembly is providing security and type boundary also.

Types of Assembly:

  • Private Assembly: It is accessible by a single application.
  • Shared Assembly: It is accessible by multiple applications.

Single File Assembly

 

Multiple File Assembly

 

Depending upon the creation, assemblies are classified into two namely static and dynamic.

  • Static Assembly: It is created when we compile our code using the compiler.
  • Dynamic Assembly: It is created during runtime. 

It also consists of assembly metadata which is known as Assembly Manifest. Information about the assembly version, resources needed by the assembly, and the scope of the assembly is stored in the manifest file.

A version of the assembly determines the types and other resources used by that application. Assemblies are providing security and type boundary also. We can specify the permission when we build our assemblies. When the assemblies are being loaded into the runtime, the assembly is sending the request for granting permission. The security engine is verifying that using security policies. The type name and its corresponding assembly determine the identity of the type. So two types with the same name but different assemblies can be managed independently.

The assembly can be kept in a single file or multiple files. The single file means that the MSIL code, metadata, resources, and assembly metadata, all are in a single file only. On the other hand, they can be separated into different files. That is known as multiple file assembly. An Assembly linker is used to link all the modules in the case of multiple structures. Sharing of the assemblies by multiple applications is also possible by adding assemblies to the Global Assembly Cache.

Advantages:

  • It is implemented as .exe or .dll .
  • It is loaded into memory whenever needed.
  • We can share assemblies between applications using GAC (Global Assembly Cache).
  • The System. Reflection namespace has classes like Assembly which can be used to get the details of the assembly and with that, it is also possible to load an assembly dynamically at runtime.
  • It increases the overall performance.

Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads