Other Posts in Visual Studio

  1. Getting Public Key and Public Key Token of a DLL, the Easy Way
  2. Automatically Splitting a Project into Smaller Projects in Visual Studio
  3. Basic Shortcuts in Visual Studio That I Use

Getting Public Key and Public Key Token of a DLL, the Easy Way


This one has no code but just explains something that has been annoying me and my solution to it. Anyway, I've been doing a lot of SharePoint development at work lately. To be honest, it's not that different from normal ASP.Net development (which shouldn't be shocking considering it's based off of ASP.Net) but the one thing that has annoyed me to no end is the constant creation of strong name assemblies... Which basically just means that I have to sign the assembly. That's easy, you just go into the properties of the project, go down to signing, click on Sign the Assembly, and create a new key. That's all there is to it.

Now figuring out what the public key/public key token for the newly signed project is, now that's an annoyance. In order to figure it out you need to use a program called sn. It can be found at C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin\sn.exe. Now going to that location, running it each time you create a new DLL is annoying... So I created a simple entry in Visual Studio to run the app for me:

  1. In Visual Studio go to Tools->External Tools
  2. Click Add
  3. Enter in the following:
    1. Title: Get Public Key
    2. Command: C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin\sn.exe (or where ever the sn program is found on your system)
    3. Arguments: -Tp "$(TargetPath)"
  4. Click OK
And that's it. Now whenever you click on the option in the Tools menu, it will pull up the public key information for the DLL. So hopefully this helps you out. So leave feedback and happy coding.