Nick Grattan's Blog

About Microsoft SharePoint, .NET, Natural Language Processing and Machine Learning

Extracting Public Key from Signed Assembly

with 3 comments

Once an assembly has been signed you can extract the public key token using the ‘sn’ .NET utility. This is necessary if you need to create a reference to an assembly, for example in the form:

<Field  Name=”FieldTypeClass”> RatingField.RatingField,RatingField, Version=1.0.0.0,Culture=neutral, PublicKeyToken=ef9f3072afebf3b0 </Field>

To do this:

  1. Run a Visual Studio 2005 command prompt (Visual Studio Tool + Visual Studio 2005 Command Prompt from the “Start” menu).
  2. Enter the following command:

sn -Tp ratingfield.dll

Where “ratingfield.dll” is the name of the signed assembly.

Advertisements

Written by Nick Grattan

August 6, 2007 at 2:14 pm

3 Responses

Subscribe to comments with RSS.

  1. […] Public Key from Signed Assembly – Method 2 Published December 17, 2007 .NET In this post I show how to extract the public key token from a signed assembly using the […]

  2. but how can i get it through c# code

    shafaqat

    October 23, 2008 at 6:22 am

  3. Hello,
    When I executed sn -Tp Y:\folder\file.dll , I got this message (translated from French) -Tp option enable only one argument

    Think you for Help

    zarrouk

    December 31, 2009 at 2:56 pm


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

%d bloggers like this: