Assemblies VB.NET

The purpose of an assembly is to specify a logical unit, or building block, for .NET applications that encapsulate certain properties.

The term assembly refers to both a logical construct and a set of physical files. To draw an analogy on the logical side, we might use the term neighborhood to refer to a zip code, a neighborhood name, and a list of street addresses. On the physical side, a neighborhood consists of the actual houses that are located at those addresses. Thus, we can speak of physically moving (i.e., deploying) the neighborhood.

A .NET application consists of one or more assemblies. Logically speaking, an assembly is just a set of specifications. In particular:

  • An assembly specifies the (MSIL) code that is associated with the assembly. This code lies in a Portable Executable (PE) file. (PE files are the traditional file types for Microsoft's code, but the format is extended for .NET applications.)
  • An assembly specifies security permissions for itself, if any.
  • An assembly specifies a list of data types and provides scoping for those types. Every data type in a .NET application must specify the assembly to which it belongs. The scoping provided by an assembly means that different types may have the same name, as long as they belong to different assemblies and can therefore be distinguished by means of the assembly to which they belong. Microsoft refers to this by saying that an assembly provides atype boundary.
  • An assembly specifies rules for resolving external types and external references, including references to other assemblies. In this way, assemblies form a reference scope boundary. Included in this information are any version dependencies for the external references.
  • An assembly specifies which of its parts are exposed outside the assembly and which are private to the assembly itself.

In addition to these specifications listed, an assembly is an object (or logical unit) that possesses certain properties:

  • An assembly has version properties. This includes a major and minor version number, as well as a revision and build number. Indeed, an assembly is the smallest unit that has versioning properties. Put another way, all elements of an assembly (types and resources) are versioned as a unit—they are assigned the version numbers of the assembly to which they belong. In other words, an assembly is a versioning unit.
  • An assembly forms a deployment unit. More specifically, at any given time, a .NET applicationonly needs access to the assemblies that specify the code under execution. Other assemblies that make up the application need not be present if the code they specify is not currently needed for execution. These assemblies can be retrieved upon demand, so that the downloading of applications can be more efficient.

Finally, we note that multiple versions of a single assembly can be run at the same time, on the same system, or even in the same process. This is referred to as side-by-side execution. The specifications in an assembly are collectively referred to as the assembly's manifest. The data in the manifest is also called metadata. Specifically, the manifest contains:

  • The name of the assembly
  • Version information for the assembly
  • Security information for the assembly
  • A list of all files that are part of the assembly
  • Type reference information for the types specified in the assembly
  • A list of other assemblies that are referenced by the assembly
  • Custom information, such as a user-friendly assembly title, description, and productinformation (company name, copyright information, and so on).

Physically, an assembly consists of one or more files—files that contain code, as well as resources, such as bitmaps. The assembly's manifest can be a separate file or part of another file in the assembly.

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd Protection Status

VB.NET Topics