GAC - Global Assembly Cache

The global assembly cache stores assemblies specifically designated to be shared by several applications on the computer.

Sn.exe (Strong Name Tool)

How to find public key token for a .NET DLL

sn -T System.Web.Mvc.dll

The following command creates a new, random key pair and stores it in keyPair.snk.

sn -k "[DriveLetter]:\[DirectoryToPlaceKey]\[KeyName].snk"
sn -k keyPair.snk

Strong-Named Assemblies

A strong name consists of the assembly's identity—its simple text name, version number, and culture information (if provided)—plus a public key and a digital signature.

To create and sign an assembly with a strong name using the Assembly Linker.

The following example signs the assembly MyAssembly.dll with a strong name using the key file keyPair.snk.

al /out:MyAssembly.dll MyModule.netmodule /keyfile:keyPair.snk

There are two ways to deploy an assembly into the global assembly cache:

  1. Use an installer designed to work with the global assembly cache.
  2. Use a developer tool called the Global Assembly Cache tool (Gacutil.exe)