Assembly Tutorial in ASP.Net C#

The new basic entity is called an Assembly. This is a collection of class modules presented as a single DLL or EXE file. Even though EXE files can also be called assemblies, most of the time we talk about libraries if we use this word. Assemblies are very similar to Java Archives (JAR).

Physically, assemblies are files located somewhere on disk and are per definition so-called Portable Executable (PE). Assemblies are loaded on demand. They are not loaded if not needed.

Assemblies have Metadata stored to provide version information along with a complete description of methods and types. Part of this metadata is a Manifest. The manifest includes identification information, public types and a list of other used assemblies.

Distinguish between the typical DLLs, we've already used in the times before .NET, Private Assemblies, used for single programs, and Global Assemblies shared among several applications.

Assemblies are still DLLs even if they differ from the former DLLs. In our context, there is no difference between the direct use of DLLs and Private Assemblies. Thus the direct use of DLLs is still an issue and not outdated.

Direct Use of DLLs
Source files may be compiled into DLLs instead of EXEs. Even if we link them later on to assemblies, we first compile them to normal DLLs. During EXE file compilation DLLs may be added directly. There is no obligation to create assemblies first.
  • Location is specified at compile time. Usually in the same folder like the application's EXE file or in any of the sub folders.
  • PATH is not checked while looking up files, neither set by Control Panel 'System' configuration nor set in a Console Window.
  • Identified by name only.
  • Get smaller EXE files.
  • Dynamic linking, i.e. loading on demand.
Private Assemblies
Intended use by single applications. Building modules to group common functionality.
  • Location is specified at compile time. Usually in the same folder like the application's EXE file or in any of the sub folders.
  • PATH is not checked while looking up files, neither set by Control Panel 'System' configuration nor set in a Console Window.
  • Identified by name and version if required. But only one version at a time.
  • Digital signature possible to ensure that it can't be tampered.
  • Get smaller EXE files.
  • Dynamic linking, i.e. loading on demand.
Global Assemblies
Publicly sharing functionality among different application.
  • Located in Global Assembly Cache (GAC).
  • Identified by globally unique name and version.
  • Digital signature to ensure that it can't be tampered.
  • Get smaller EXE files.
  • Dynamic linking, i.e. loading on demand.
Tags: , , , , , , , , ,
Hot on Web:


About author