This is very needful post. Most of the times in general development we work on class library projects which outputs DLL at the end. To use them we may need to know the Public Key Token of the DLL and use it wherever needed. We can know the Public key token either through the command prompt SN.EXE or by deploy it to GAC. But, what if you have some tool available and displays the Public key token within Visual Studio?
- In Visual Studio, go to Tools, and chose External Tools option as shown.'
- You will be open up with a new window and enter the details as shown below.
- Title as “Get Public Key Token”
- Command as “C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bin\sn.exe”. Remember, if you installed Windows SDK then the above location works, otherwise please chose the location where SN.EXE presents.
- Arguments as “-Tp "$(TargetPath)"”
- And uncheck all checkboxes at bottom and check only the option “Use Output Window”.
- At the end the settings should look as shown below.
- Now, click OK button and go to tools, you will see there is a new menu item added in the list as shown below.
- So, we are all set to use the tool now. Once you build the class library project, then just click on this “Get Public Key Token” option. From the output window, you will see the BLOB of the DLL and public key token as shown below.
That’s it. This is very helping one to me. Hope you also like it. Reference