-->
Applies to: SharePoint Foundation 2010
Online RSA Key Generator. Key Size 1024 bit. 1024 bit; 2048 bit; 4096 bit Generate New Keys Async. RSA Encryption Test. Text to encrypt. Jun 18, 2008 As I get started with my deep dive into learning SharePoint, something that comes up a lot is the need to find the public key token of the current.NET assembly. He just showed a great shortcut. In Visual Studio, go to the Tools menu and choose External Tools. That brings up a new dialog window. Click the Add button and add the following.
SharePoint Foundation development projects often involve a mixture of imperative coding and XML markup. Frequently, you add your new assembly's Public Key Token to a project file, such as an XML configuration file. If your Visual Studio project is based on any of the SharePoint 2010 project templates in Visual Studio, you can simply insert the placeholder $SharePoint.Project.AssemblyPublicKeyToken$ where the Public Key Token should be in most kinds of project files (but not .cs or .vb files or other compilable files). When you build and deploy the project, Visual Studio will replace the placeholder with the Public Key Token in the copies of the files that are actually deployed. (For more information about the use of SharePoint-oriented Visual Studio placeholders, see Replaceable Parameters.)
If you need to insert the Public Key Token in a file that does not support the placeholders, you will need a way to obtain the Public Key Token. This topic explains how to add an item to the Visual StudioTools menu that can be used to obtain the Public Key Token of an assembly under development.
Publickeytoken
To add a Get Assembly Public Key item to the Tools menu
In Visual Studio, click External Tools on the Tools menu.
In the External Tools dialog box, click Add and enter Get Assembly Public Key in the Title box.
Fill the Command box by browsing to sn.exe. It is typically installed at the following location: C:Program Files (x86)Microsoft SDKsWindowsv7.0aBinx64sn.exe.
In the Arguments box, type the following (case sensitive): -Tp $(TargetPath).
Select the Use Output window check box.
Click OK. The new command is added to the Tools menu.
Whenever you need the Public Key Token of the assembly you are developing, click the Get Assembly Public Key command on the Tools menu, and the public key token appears in the Output window.
Note
Because the Public Key Token does not exist until the assembly is compiled the first time, you will need to compile the project before using the tool.