Thursday, August 16, 2012

Get public key token of a .Net assembly


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:
1Sn.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.

No comments:

Post a Comment