How to get an assembly's public Token, with capital "T"


Sometimes I forget this simple fact and drives me crazy (and for those who are learning to do this for the first time).

The parameters of the SN.exe (Strong Name Utility) tool, are CASE SENSITIVE, so… For getting the Public key token of a Strongly named assembly:

sn -T "Microsoft.IdentityModel.Clients.ActiveDirectory.dll"

With the T as capitalized as you can. The “straightforward” error response you get if you do -t is:

Failed to convert key to token -- Invalid assembly public key.

And that is correct because….

-t[p] <infile>
    Display token for public key in <infile> (together with the public key
    itself if -tp is used).
  -T[p] <assembly>
    Display token for public key of <assembly> (together with the public key
    itself if -Tp is used).

…geez, some usability please 🙂 I promise a later post on developer usability….

Of course do this from the Developer Command Prompt, developers should always have a shortcut to this on the desktop. Grumpy dev has a shortcut. Grumpy dev is smart. Be like Grumpy dev.

Comments (0)

Skip to main content