Difference between Private and Shared Assembly in C#

Difference between Private and Shared Assembly in C#

 Private Assembly : When we build an assembly which can be only used by particular Application, then that assembly will be called as Private Assembly. Private Assembly create the separate copy of assembly with each user application.

Steps : 1.) Create dll file

2.) Create a Console Application

3.) Adding reference of .dll file to console application and call it. 

To know it with more knowledge go to : Create Private Assembly Application in C sharp

Shared Assembly : When we deploy an application which can be used by several apllication, then the Assembly will be known as Shared Assembly. These assembly muwt have Strong Key Name(.snk) file in it and these assembly must associated in Global Assembly Cache(GAC).

While use of shared assembly copy assembly does not created with each application rather than each client application has referenced to the same assembly.

Steps :

1.) Create .dll file.

2.) Creating .snk File

3.) Associate dll file with .snk file.

4.) Adding dll to GAC

5.) Create a Console Application

6.) Adding reference of dll to console application

Last updated:7/5/2021 12:45:59 AM
Shivam Prajapati

Shivam Prajapati

Hey! Shivam Prajapati here, I've completed my studies from Bishop Johnson School & College and Right now I'm pursuing BCA 2nd Year from Ewing Christian College.


Leave Comment