We need the public key token of .NET assembly(.DLLor .EXE) while registering in configuration files. The solution is very easy, by using strong name utility(sn.exe) provided by Microsoft SDK we can find the public key token.
Using sn.exe
open visual studio command prompt then go to the location where your assembly resides, then type
"c:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\sn.exe" -T myapplicatoin.dll
If myapplicationl.dll is in D:\sampleapplication\bin\debug then the command prompt should looks likeD:\sampleapplication\bin\debug > "c:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\sn.exe" -T myapplicatoin.dll
Hit enter button, then output will beMicrosoft (R) .NET Framework Strong Name Utility Version 3.5.30729.1
Copyright (c) Microsoft Corporation. All rights reserved.
Public key token is 891468bb1a0b2ec6
other ways of getting public key token are
From GAC folder:
If the dll is registered to GAC, then you find the public token by opening the folder. It look like 10.0.0.0__b03f5f7f11d50a3a
Using VS External Tool:
From visual studio we can generate public key token for the current project by adding external tool. Go to visual studio -> Tools menu --> select External Tools... then a window will be opned. From the window click on Add button > provide Title as "Read Publickey Token" > select command as "c:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\sn.exe" > write arguments as "-T $(TargetPath)" > check Use Output Window checkbox > Ok.
Now we can see "Read Publickey Token" from Tools menu > select it > from output window you can see the Publickey Token.
Note: If assembly is not registered with strong name key then by executing the above command gives you the message as ".exe/.dll does not represent a strongly named assembly"