When you compile an application, the MSIL code created is stored in an assembly.Assemblies include both executable application files(.exe files)& libraries(.dll extension)for use by other application.
In addition to containing MSIL,assemblies also include met information(i.e. information about the information contained in assembly,also called as meta-data)and optional resources(sound and picture file, etc).The meta information enables assemblies to be fully self-descriptive.You need no other information to use an assembly,meaning you avoid situations such as failing to odd required data to the system registry and so on,which was often a problem when developing with other platforms.
This means that deploying applications is often as simple as copying the files into a directory on a remote computer.Because no additional information is required on the target system,you can just run an .exe file from this directory.
Of course,you would not necessarily want to include everything required to run an application in one place.You might write some code that performs tasks required by multiple applications.In that situation it is often useful to place the reusable code in a place accessible to all applications. In the .NET framework,this is Global Assembly Cache(GAC).Placing code in GAC is simple-you just place the assembly containing this cache.
Creating and using an Assembly/Class LibraryTo create an assembly or class library in C# select class library project from new project window. Then clock on OK. A new code editor will be opened write the following code in it,
public class Demo
Console.WriteLine("Welcome to Class Library Project");
Now build the above class library and save it. Now create a new console application. Right click on the project name and click on "add refference". Then browse the class library you now created and add it to your console application.
Then write the following code to use the class library,
using Demo;//Implementing class library in our application
static void Main(String args)
//creating object of class library class
Demo d = new Demo();
//using the show method of the class library
The output of the above console application will be "Welcome to Class Library Project". Similarly we can use class libraries in different languages of .NET. In VB.NET you have to use "import" instead of "using" to add the class library.