Wednesday, October 17, 2012

How to get Public key token in Visual Studio 2010


I was developing a custom application for SharePoint and needed to assign it with strong name I assigned a strong name to my project. Now was the time to see the token generated for it. I went ahead and tried to drag that assembly to GAC but I got access denied.

Development machine is Windows Server 2008. Now I tried installing it using GACUTIL but I got the same result even being the administrator of the machine.

Challenge comes in when you want to know the public key token that has been generated for the project so that you can make modification in web.config file.

So here is a solution. We will create an external command that will get us the public key token of the project. So that when that command is clicked we get to see result in command window.

Follow these simple steps. Make sure about spacing and parameters shown here.

Go to Tools menu and then external tools.
Click Add button on which the dialog opens.

Set textbox values like this

Command text box value is

C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\NETFX 4.0 Tools\sn.exe

Click on OK.

Now when you again click on Tools menu, you get to see our command.

Click on it and we will get the result in output window and from there you get to know the public key token.

I hope this will help while you are developing any custom component in SharePoint.

No comments:

Post a Comment