Creating strong names in .NET using Strong Name Tool
Asked Answered
T

6

6

After getting the instruction from google, I've tried to create StrongNameFile with the following command:

C:\Program Files\Microsoft Visual Studio 9.0\VC\sn -k StrongNameFile.snk

When I ran the command, I got an error message:

'sn' is not recognized as an internal or external command, operable program or batch file.

I tried it in the following way:

C:\Program Files\Microsoft Visual Studio 9.0\SDK\v3.5\Bin>sn -k StrongNameFile.snk

But got the same error. Please somebody help me to solve this problem.

Tishtisha answered 18/1, 2010 at 4:45 Comment(0)
D
10

Open a Visual Studio Command Prompt instead of a normal command prompt. (Start > Microsoft Visual Studio 2008 > Visual Studio Tools > Visual Studio Command Prompt.) This will set up your PATH to include the .NET Framework SDK directories, which include sn.exe.

If you need to set up the path manually for your own scripts or command prompts, the path you need is:

C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin

(Exact version number may vary.)

Dido answered 18/1, 2010 at 4:50 Comment(2)
Hi itowlson, I am using Visual Studio Express Edition 2008, there i cant find the command prompt from tools menu....Pls tell me in Express Edition 2008 where can i find this command prompt???Tishtisha
Hmm, sorry, I don't have access to Express Edition. But if you are using VS, you don't need to run sn -k: just go to Project > Properties > Signing tab, check the "Sign the assembly" check box, and select "New..." in the drop-down box. Or if you really need the command-line utility, and if Express doesn't give you the Microsoft SDKs path I mentioned, you can download the Windows SDK from msdn.microsoft.com/en-nz/windows/… (you only need the .NET Framework bits).Dido
E
1

You're probably using a DOS command prompt. You actually want a Visual Studio Command Prompt when executing sn.

Expugnable answered 18/1, 2010 at 4:51 Comment(0)
D
0

Use the Visual Studio 2008 Command Prompt shortcut in your Start menu:

All Programs | Microsoft Visual Studio 2008 | Visual Studio Tools | Visual Studio 2008 Command Prompt.

In that, use command "sn".

That shortcut sets up the path environment vars you need.

Deadlight answered 18/1, 2010 at 4:51 Comment(0)
R
0

As an alternative to all the other answers here, you could have searched your hard disk for sn.exe...

Rhaetia answered 18/1, 2010 at 4:54 Comment(0)
C
0

this works in below steps: If you have Visual Studio 2012/2013, open the command prompt of visual studio then browse to the path C:\Program Files (x86)\Microsoft Visual Studio 12.0\SDK\v3.5\Bin> then run below commands Create the key file by running this command: sn -k c:\pairkey.snk Extract the public key to file: sn -p c:\pairkey.snk c:\pubkey Extract public key and public key token from file: sn -tp c:\pubkey

Complaisance answered 9/9, 2016 at 17:26 Comment(0)
B
0

Step 1: Developer Command Prompt for visual studio by searching on start menu.

Step 2:C:\Windows\system32> it will come on command promt.

Step 3:chnage the directory on your wish .You can give your solution directory like .cd D:\Learning\Projects\Biztalk\EAISchemas

Step 4: In command prompt, from the folder where you want to store the key file, type the following command, and ENTER:

sn /k file_name .snk

Example: sn /k ErrorHandlingProcess.snk

The above Step can be followed for any Visual Studio Solution

Buckskin answered 15/11, 2020 at 14:57 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.