How to Find sn.exe

by agrace 2. December 2008 20:55

If you are in the business of deploying SharePoint Web Parts to the bin directory, then this little titbit may save you some time. In order to add a <SafeControl> entry to the Web.config file, you need to create something like this in the <SafeControls> section:

<SafeControl Assembly="SecureLinks, Version=1.0.0.0, Culture=neutral,    PublicKeyToken=9f4da00116c38ec5"
   Namespace="SecureLinks"
   TypeName="*"
   Safe="True"></SafeControl>

 

You need to obtain the PublicKeyToken and the way to do this is to run the sn.exe command-line utility. Right-click on the Visual Studio command prompt and select "run as administrator". Change your path to: C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin>. This is where the elusive sn.exe resides!

Now you can call it using: sn.exe -T C:\inetpub\wwwroot\wss\VirtualDirectories\80\bin\SecureLinks.dll. Substitute your own port number and Web Part name; my port was 80 and the Web Part was called SecureLinks. Also, make sure this is actually a capital "T". Running this command should return something like this: Public key token is 9f4da00116c38ec5.