Software Architecture-To find public key token of an assembly

Objective: To find public key token of an assembly.
Explanation:
Strong name utility named sn.exe can be used to find the public key token of an assembly as below:

c:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin>sn.exe -T C:\Windows\Mic
rosoft.NET\Framework\v2.0.50727\system.directoryservices.dll

Microsoft (R) .NET Framework Strong Name Utility  Version 3.5.30729.1
Copyright (c) Microsoft Corporation.  All rights reserved.

Public key token is b03f5f7f11d50a3a

c:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin>sn.exe -T C:\Windows\Mic
rosoft.NET\Framework\v2.0.50727\system.data.dll

Microsoft (R) .NET Framework Strong Name Utility  Version 3.5.30729.1
Copyright (c) Microsoft Corporation.  All rights reserved.

Public key token is b77a5c561934e089

Second way is to wire thing in Visual studio 2010, Go to Tools>>External Tools and add new tool by providing:
Title: Get Public Key Token
Command: C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bin\sn.exe
Arguments: -T $(TargetPath)
Check the Use Output Window checkbox. So screen looks like as:


Now click on menu in tools as “Get Public Key Token” to see the public key token of current assembly in output window as:

Microsoft (R) .NET Framework Strong Name Utility  Version 3.5.30729.1
Copyright (c) Microsoft Corporation.  All rights reserved.
Public key token is 4cb554340e8b008b

Reference: http://msdn.microsoft.com/en-us/library/k5b5tt23(v=VS.100).aspx

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

%d bloggers like this: