Monday, January 08, 2007

Getting Key Token of a Signed Assembly

To obtain the public key token from strong-named and signed assembly, I normally use the Reflector tool to view it. Lately, I discovered that you can get the key token from the Visual Studio.NET IDE tool, too. Here are the steps

1. Open Visual Studio 2005, click Tools -> External Tools...
2. Click Add and enter the following inputs

Title: Get Public Key
Command: C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin\sn.exe
Arguments: -Tp "$(TargetPath)"

* Uncheck all options, except Use Output window\

After clicking OK, go to the "Get Public Key" in the Tools Menu.

And you would get the public key as well as its token in the OUTPUT WINDOW.