Sunday, January 9, 2011

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?

  1. In Visual Studio, go to Tools, and chose External Tools option as shown.'image
  2. You will be open up with a new window and enter the details as shown below.
    1. Title as “Get Public Key Token”
    2. 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.
    3. Arguments as “-Tp "$(TargetPath)"”
    4. And uncheck all checkboxes at bottom and check only the option “Use Output Window”.
  3. At the end the settings should look as shown below.
    image
  4. Now, click OK button and go to tools, you will see there is a new menu item added in the list as shown below.image
  5. 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.image

That’s it. This is very helping one to me. Hope you also like it. Reference

Categories:

3 comments:

  1. great job, helped me a lot!

    ReplyDelete
  2. This is the second article, i've seen, but how do i pick the file that I want? thanks.

    ReplyDelete