user584018
user584018

Reputation: 11304

how shared assembly is different from private assembly?

Per definition, A private assembly is normally used by a single application, and is stored in the application's directory, or a sub-directory beneath. and A shared assembly is normally stored in the global assembly cache, which is a repository of assemblies maintained by the .NET runtime. Shared assemblies are usually libraries of code, which many applications will find useful, e.g. Crystal report classes that will be used by all application for Reports.

As per above definition, the GAC registration is not required for a shared assembly, but generally we do GACA, also there is a situation that we can keep a assembly in a local network and multiple application use the same assembly, can we say that assembly as a shared assembly?

how shared assembly is different from private assembly?

Upvotes: 0

Views: 6160

Answers (2)

Anton Lyhin
Anton Lyhin

Reputation: 1935

I think the following comparison is very presice.

Private Assembly:

  1. Private assembly can be used by only one application.
  2. Private assembly will be stored in the specific application's directory or sub-directory.
  3. There is no other name for private assembly.
  4. Strong name is not required for private assembly.
  5. Private assembly doesn't have any version constraint.

Public (Shared) Assembly:

  1. Public assembly can be used by multiple applications.
  2. Public assembly is stored in GAC (Global Assembly Cache).
  3. Public assembly is also termed as shared assembly (note: shared between projects).
  4. Strong name has to be created for public assembly.
  5. Public assembly should strictly enforce version constraint.

Additional note: in Visual Studio the private assembly will be automatically copied. A new copy will be created in bin folder each time we reference private assembly in other project using "add reference".

Upvotes: 1

Apocatastasis
Apocatastasis

Reputation: 500

Depends on what means "shared" for you. If for shared you mean an assembly to put in the GAC, the main difference is that shared assemblies have a strong name, which gives them a unique identity. Here you can find more details http://windowsdevcenter.com/pub/a/dotnet/2003/03/17/bindingpolicy.html

Upvotes: 0

Related Questions