Assembly is the smallest unit of deployment, it is the collection of various things to perform a common task or goal. It is also called the logical entity that is collection of information to execute an
Types of Assembly
- Private assembly (.dll and .exe are at same place)
- Shared assembly
(.dll and .exe are at different place)
Dynamic assembly (dynamically create )
- Distributed assembly (in different parts)
- Satellite assembly (on network)
For using a shared assembly an application must have a key (token) for
authorization and authority.
When .dll and main file are not in same folder & main file can't direct access
the .dll file. It must take permission for Runtime manager for using that .dll,
then the collection to run the file can be known as shared assembly.
Steps to create Shared assembly
Step 1: Create a class file
public class Bike
Step 2: Generate the token
This token known as strong name key. It is the string that is large collection of alphabet and numeric value, it is very big-string. It is also so long so that
no one can access without any permission.
--> open command prompt of visual studio
sn -k shrd.snk
This will create a key having name shrd.snk(128 bit key ).
Note: To generate the key it use RSA2 (Rivest
Shamir Alderman) algorithm.
Step 3: Apply the key on our class file by written the code in .dll
add this code to your class file
public class Bike
Step 4: Complied the
code file & Create a .dll file of Bike class
Step 5: Now
register/install .dll into GAC. GAC is the database of CLR in case of .NET.After
installing this .dll in GAC, any file can use it with the help of CLR.
D:\shared assembly>gacutil /i
Step 6: The Client Application are as
public class MainP
public static void Main(string
Bike bk=new Bike();
Step 7: Compiled the
csc /r:d:\shared assembly\sharedAss.dll MainP.cs
Step 8: Run your program by using the command given below: