8-Week Microsoft Teams AppDev Accelerator Program
Limited seats available! - Start date: Wednesday, April 16, 2025
Join Today & Save $1,000
articles

Get Public Key Token & Blob for Signed Assembly in VS 2005

The text describes a new way for Web Part developers to obtain the public key token and blob for a signed assembly using Visual Studio 2005.

Get Public Key Token & Blob for Signed Assembly in VS 2005
by Andrew Connell

Last updated September 15, 2006
2 minutes read

Share this

Focus Mode

  • Feedback & questions

David Bailey from RDA Corp clued me into a very slick way to obtain the public key token and blob for a signed assembly directly from within Visual Studio 2005. This is a common task for Web Part developers as we need the public key token when creating entries in the web.config among other places in SharePoint.

Previously I was opening the signed assembly and get the public key token using Lutz’s Reflector. The public key token is displayed in the footer of Reflector, like so:

Obtaining public key token using Reflector

Obtaining public key token using Reflector

The way to get the public key token using the .NET 2.0 provided utilities is to open a Visual Studio 2005 command prompt and typing: sn.exe -T [full path to strong named assembly]

However, there’s an even easier way using the external tools dialog in Visual Studio 2005 which David demonstrated in our SharePoint Developer class earlier today.

  1. In Visual Studio 2005, select Tools > External Tools…
  2. Click Add and enter the following into the different fields as displayed in the following screenshot:
    • Title: Get Public Key
    • Command: C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin\sn.exe
    • Arguments: -Tp “$(TargetPath)”
    • Uncheck all options, except Use Output window
Creating an external tool in Visual Studio 2005

Creating an external tool in Visual Studio 2005

Now, you have a new entry listed in the Tools menu titled Get Public Key as shown in the following screenshot:

Get Public Key menu item in the Visual Studio Tools menu

Get Public Key menu item in the Visual Studio Tools menu

Assuming you have a project open that has been configured to be signed when built, and you’ve built it at least one time, selecting the new Get Public Key menu item from the Tools window to get the public key token and blob in the Output window, as shown here:

Results of Get Public Key menu item in the output window

Results of Get Public Key menu item in the output window

Very slick! You can even take this one step further by adding a button to a toolbar by customizing your toolbar and adding a button from the Tools category. you should pick External Command # where # is the index of the external command from the External Tools window (in my screenshots above, this is External Command 3). Then you can change the name of the button to be Get Public Key as shown below:

Custom button Get Public Key on the toolbar

Custom button Get Public Key on the toolbar

Very cool! Thanks David!

Andrew Connell, Microsoft MVP, Full-Stack Developer & Chief Course Artisan - Voitanos LLC.
author
Andrew Connell

Microsoft MVP, Full-Stack Developer & Chief Course Artisan - Voitanos LLC.

Andrew Connell is a full stack developer who focuses on Microsoft Azure & Microsoft 365. He’s a 20+ year recipient of Microsoft’s MVP award and has helped thousands of developers through the various courses he’s authored & taught. Whether it’s an introduction to the entire ecosystem, or a deep dive into a specific software, his resources, tools, and support help web developers become experts in the Microsoft 365 ecosystem, so they can become irreplaceable in their organization.

Feedback & Questions

newsletter

Join 10,000+ developers for news & insights

No clickbait · 100% free · Unsubscribe anytime.

Subscribe to Andrew's newsletter for insights & stay on top of the latest news in the Microsoft 365 Space!
blurry dot in brand primary color
found this article helpful?

You'll love these!

Web Content Management in MOSS 2007: Terminology Explained

Web Content Management in MOSS 2007: Terminology Explained

September 7, 2006

Read now

Web Content Management in MOSS 2007: Terminology Explained

Web Content Management in MOSS 2007: Terminology Explained

September 7, 2006

Read now

When 'F5' debugging and attaching to processes is slow

When 'F5' debugging and attaching to processes is slow

May 10, 2006

Read now

bi-weekly newsletter

Join 10,000+ Microsoft 365 full-stack web developers for news, insights & resources. 100% free.

Subscribe to Andrew's newsletter for insights & stay on top of the latest news in the Microsoft 365 ecosystem!

No clickbait · 100% free · Unsubscribe anytime.

Subscribe to Andrew's newsletter for insights & stay on top of the latest news in the Microsoft 365 Space!