Assemblies in C#: Part 2

This article explains assemblies in C# with an example.

Before reading this article, I Would recommend reading the following previous part.

Step 1

Create a folder with the name csharp in the D drive.

Filename: csharpcorner.cs

With the following code:

  1. using System;  
  2. namespace csharpcorner  
  3. {  
  4.    public class Titles  
  5.    {  
  6.       public void Display()  
  7.       {  
  8.          Console.WriteLine("welcome to .net");  
  9.       }  
  10.    }  
  11. }  

Step 2

Open a Visual Studio command prompt as administrator.



Figure 1: Developer Command Prompt for VS2013

Step 3





Note: /t for target, it creates csharpcorner.netmodule (in other words a CIL/MSIL code).

Step 4





Note: k for keyfile, it creates a public key.

Step 5



Note: al for assembly linker, it creates a strongname assembly and also provides security to an assembly.

Step 6

FileName:test.cs


Step 7

The .exe file should be created and attached to the DLL file, /i for install and /u for uninstall.





Similarly, repeat the preceding procedure for Version 2 also.

Step 8

FileName:csharpcorner.cs

  1. using System;  
  2. namespace csharpcorner  
  3. {  
  4.    public class Titles  
  5.    {  
  6.       public void Display()  
  7.       {  
  8.          Console.WriteLine("welcome to Asp.net MVC");  
  9.       }  
  10.    }  
  11. }  

Note 1: To difffereniate between version 1 and version 2, I changed the text from Welcome to .net to welcome to ASP.Net MVC in the preceding file.

Step 9