Thursday, 18 October 2007

Checking an assembly is strong named

A strong named assembly's identity consists of a simple text name, version number, and culture information (optional) - plus a public key and a digital signature.

  • Strong names guarantee name uniqueness by relying on unique key pairs
  • Strong names protect the version lineage of an assembly. A strong name can ensure that no one can produce a subsequent version of your assembly.
  • Strong names provide a strong integrity check. Passing the .NET Framework security checks guarantees that the contents of the assembly have not been changed since it was built.

If you want to add an assembly to the GAC but aren't sure if it is strong named (maybe because it is a third party library) - You can ensure that an assembly is globally unique quite easily:

1. Use the strong name tool which is part of the .Net framework tools in the .Net SDK.

sn -v assembly
2. Even easier - Using explorer, click and drag assembly into \windows\assembly directory. If you don't get a descriptive error message then the assembly was strong named and is now gac'd :)