Caveman's Blog

My commitment to learning.

How to get public key token of a .Net assembly?

leave a comment »


Updating the application configuration file with the latest version and the correct public key token is important for a .Net application to execute successfully. One can look up the public key token of a .Net assembly in one of the following ways.

1. Using Reflector:

Open the assembly using .Net Reflector [1]. Click on the assembly name and Reflector will show the details of the assembly in the pane to the bottom of the application like in the example below:

2. Using Sn.exe

Launch the .Net command prompt and execute the following command. Keep in mind that the arguments are case sensitive. Check out the following example for the usage:


Sn.exe - Tp <assemblyname>

Watch out for the following error in case of a incorrect command line argument: Failed to convert key to token — The public key for assembly ‘(null)’ was invalid.

References:

1. Reflector

Advertisements

Written by cavemansblog

February 3, 2011 at 12:54 pm

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: