Skip to main content

What is Assembly in .Net? Contents of Assembly

Assemblies are the building blocks of .NET Framework applications; they form the
fundamental unit of deployment, version control, reuse, activation scoping, and
security permissions. An assembly is a collection of types and resources that are
built to work together and form a logical unit of functionality. An assembly provides
the common language runtime with the information it needs to be aware of type
implementations. To the runtime, a type does not exist outside the context of an
assembly.

An assembly does the following functions:

• It contains the code that the runtime executes.
• It forms a security boundary. An assembly is the unit at which permissions are
requested and granted.
• It forms a type boundary. Every type’s identity includes the name of the
assembly at which it resides.
• It forms a reference scope boundary. The assembly's manifest contains assembly
metadata that is used for resolving types and satisfying resource requests. It
specifies the types and resources that are exposed outside the assembly.
• It forms a version boundary. The assembly is the smallest version able unit in the
common language runtime; all types and resources in the same assembly are
versioned as a unit.
• It forms a deployment unit. When an application starts, only the assemblies the
application initially calls must be present. Other assemblies, such as localization
resources or assemblies containing utility classes, can be retrieved on demand.
This allows applications to be kept simple and thin when first downloaded.
• It is a unit where side-by-side execution is supported.

Contents of an Assembly

• Assembly Manifest
• Assembly Name
• Version Information
• Types
• Locale
• Cryptographic Hash
• Security Permissions

Assembly Manifest

Every assembly, whether static or dynamic, contains a collection of data that
describes how the elements in the assembly relate to each other. The assembly
manifest contains this assembly metadata. An assembly manifest contains the
following details:

• Identity. An assembly's identity consists of three parts: a name, a version
number, and an optional culture.
• File list. A manifest includes a list of all files that make up the assembly.
• Referenced assemblies. Dependencies between assemblies are stored in the
calling assembly's manifest. The dependency information includes a version
number, which is used at run time to ensure that the correct version of the
dependency is loaded.
• Exported types and resources. The visibility options available to types and
resources include "visible only within my assembly" and "visible to callers outside
my assembly."
• Permission requests. The permission requests for an assembly are grouped into
three sets: 1) those required for the assembly to run, 2) those that are desired
but the assembly will still have some functionality even if they aren't granted,
and 3) those that the author never wants the assembly to be granted.

In general, if you have an application comprising of an assembly named Assem.exe
and a module named Mod.dll. Then the assembly manifest stored within the PE
Assem.exe will not only contain metadata about the classes, methods etc. contained
within the Assem.exe file but it will also contain references to the classes, methods
etc, exported in the Mod.dll file. While the module Mod.dll will only contain metadata
describing itself.

The following diagram shows the different ways the manifest can be stored:

Comments

Popular posts from this blog

Code To Convert rupees(numbers) into words using C#.Net

Introduction: In my previous article I have explained about how to validate emailid using javascript . In this article I am going to explain about code used to convert rupees(numbers) into words using C#.Net . Explanation: For explanation purpose I have a page. It has a textbox to input the numbers. And when you click on the convert to words button then it will convert the input numbers into words and shows it in the below label. Below is the C# code used to do this functionality. public static string NumbersToWords( int inputNumber) {     int inputNo = inputNumber;     if (inputNo == 0)         return "Zero" ;     int [] numbers = new int [4];     int first = 0;     int u, h, t;     System.Text. StringBuilder sb = new System.Text. StringBuilder ();     if (inputNo < 0)     {         sb.Append( "Minus " );         inputNo = -inputNo;     }     string [] words0 = { "" , "One " ,

C# code to send mail using smtp from gmail,yahoo mail and live mail

Introduction: In my previous article I have explained about   How to bind/Unbind events in jQuery . In this article I am going to explain about how to send mail from ASP.Net using gmail,yahoomail and live mail credentials. Explanation: First Include the below namespaces in your code behind file. using System; using System.Net; using System.Net.Mail;

Geckofx Browser in Winform Application

Bored with IE browser in your winform application ? Want to do everything as you doing in your Firefox or Chrome Browser ? Play with automation ? Then here is your choice . Introduction:  GeckoFX is a Windows Forms control written in clean, commented C# that embeds the Mozilla Gecko browser control in any Windows Forms Application. It also contains a simple class model providing access to the HTML and CSS DOM . GeckoFX was originally created by Andrew Young for the fast-growing visual CSS editor, Stylizer . It is now released as open-source under the Mozilla Public License.  You can download it here :   Geckofx 22.0 And the supporting file Xulrunner here :   Xulrunner Files Hope you have downloaded above two files. Here our journey going to start. Create your winform application in visual studio and do the following: right click the toolbox -> Choose items -> Browse the "Geckofx-winforms.dll" and click "yes" for “Load it anyw