Giving a dll a strong name

To be able to register a DLL to the windows assembly it should have a strong name. This can be accomplished with the strong name tool "Sn.exe".

When you try to register a DLL to the windows assembly, you might get the following error:
Failure adding assembly to the cache: Attempt to install an assembly without a strong name

To solve this you should use the strong name tool "Sn.exe". This tool generates a public/private key pair. This public and private cryptographic key pair is used during compilation to create a strong-named assembly.

With the tool you generate two files: a key file containing a private-public-key-pair and a file containing the public-key.

  1. To generate the private-public-key-pair file you perform the command:
    sn –k "private-public-key-pair file name"
  2. To extract the public-key file you perform the command:
    sn –p "private-public-key-pair file name" "public-key file name"