Private And Shared Assembly in .Net

In this blog, I’m trying to explain the private and shared assembly and differences between them.

Private Assembly

This type of assembly is used by a single application. It is stored in the application's directory or the applications sub-directory. There is no version constraint in a private assembly.  

Shared Assembly or Public Assembly

 A shared assembly has version constraint. It is stored in the Global Assembly Cache (GAC). GAC is a repository of shared assemblies maintained by the .NET runtime. It is located at C:\Windows\Assembly OR C:\Winnt\Assembly. The shared assemblies may be used by many applications. To make an assembly a shared assembly, it has to be strongly named. In order to share an assembly with many applications, it must have a strong name. 

Differences between Private and Shared Assembly

  • Private assembly can be used by only one application.
  • Shared assembly can be used by multiple applications
  • Private assembly will be stored in the specific application's directory or sub-directory.
  • Shared assembly is stored in GAC (Global Assembly Cache).
  • There is no other name for private assembly.
  • Shared assembly is also termed as shared assembly
  • Strong name is not required for private assembly.
  • Strong name has to be created for shared assembly.
  • Private assembly doesn't have any version constraint.
  • Shared assembly should strictly enforce version constraint.

Leave Comment