How to use .NET Assemblies in VB.NET

Here's a comprehensive introduction to .NET assemblies.
  • 3294


An assembly is the .NET name for an executable file. In other words, a .NET assembly is just the .EXE and .DLL file. One assembly can contain one or more files. The constituent files can include any file types like image files, text files etc. along with DLLs or EXE. When you compile your source code by default the exe/dll generated is actually an assembly. Unless your code is bundled as assembly it can not be used in any other application.

Private and Shared assembly

There are two kind of assemblies in .NET:

  • shared
  • private 

Shared Assembly

A shared assembly is used by multiple applications and is typically stored in a global folder known as the Global Assembly Cache (GAC). When building an assembly, a developer must specifically choose to build it as a shared assembly by giving it a cryptographically strong name. For example, the .NET Framework is a collection of shared assemblies.

Private Assembly

A private assembly is used only by a single application and is stored in that application's installation folder. The name of a private assembly name must be unique within the application that uses it. Suppose you created a DLL. This DLL will be used by your client application only and not by any other application. In order to run the application properly your DLL must reside in the same folder in which the client application is installed. Thus the assembly is private to your application.

Global Assembly Cache (GAC)

Global assembly cache is a special disk folder where all the shared assemblies is stored. It is located under <drive>:\WinNT\Assembly folder.

Assembly Structure 


 Assembly Metadata


  Type Metadata


       IL Code




A .NET assembly may contain the following elements.

1. Assembly Manifest


Metadata that describes the assembly and its contents.

2. Source Code


Compiled into Microsoft intermediate language (MSIL).

3. Type Metadata


Defines all types, their properties and methods, and most importantly, public types exported from this assembly.

4. Resources


Icons, images, text strings and other resources.


To view assembly contents

At the command prompt, type the following command:

ildasm <assembly name>

In this command, assembly name is the name of the assembly to examine.

The following example opens the myassembly.exe assembly.

ildasm myassembly.exe


Hope this article would have helped you in understanding assemblies in .net. If there is any mistake in this article then please notify me. I expect your valuable comments and feedback about this article.


More Articles

© 2020 DotNetHeaven. All rights reserved.