Setup a ‘Get Public Key’ Tool

If you’re a SharePoint developer, you’ve run into public key tokens but what you might not know is that Visual Studio comes with an executable that can make retrieving them a much easier process.

The following steps will add a “Get Public Key’ option to your Tools menu in Visual Studio:

  • Click ‘Tools > External Tools’
  • Click ‘Add’ and a new entry will appear
  • In the ‘Title’ field type: Get Public Key
  • Click the ‘…’ button and navigate to the appropriate sn.exe
  • If VS 2008: C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bin\sn.exe
  • If VS 2010*: C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\sn.exe
  • In the ‘Arguments’ field type: -Tp “$(TargetPath)”
  • Select ‘Use Output window’ checkbox
  • Click ‘OK’

External Tools screenshot

This will save you a ton of time if you are still using tools like Reflector to get the public key.

* This path is from a 64-bit version of Windows.

Advertisements

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