Creating Strong Names Using Visual Studio Command Prompt

In this post we will see how we can create strong names using Visual Studio Command Prompt. Here I am going to use Visual Studio 2012. Before going through the steps to create a strong name, we will define what exactly a strong name is. I hope you will like this.

What is a strong name

Basically a strong name is a container which consists of assembly’s information. For example, it contains the name of the assembly, culture information, version number, public key, and digital signature. It can be generated using developer tools like visual studio command prompt from an assembly file.

The strong names are unique (and yeah it must be). By creating an assembly with strong names you can make sure that the name is globally unique. You can find some more information about strong names here.

If you need to find the public key of a DLL, you can see here: How to find PublicKeyToken of a DLL

Steps to Create Strong Names

Step 1: Opening visual studio command prompt

To open a command prompt, you can either go to shortcuts from the directory as,

C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\Tools\Shortcuts

Or you can go to start, then type Visual Studio-> You can find Visual Studio Tools folder.


Step 2: Run Command Prompt

Just click on the command prompt and run as administrator.


Step 3: Creating .snk file

To create a strong name, you need to run the following command in the command prompt.

C:\Program Files (x86)\Microsoft Visual Studio 12.0\SDK\v3.5\Bin>sn -k "c:\stron

Here, the visual studio and framework versions will be changed as your version. And the strong name strong.snk will be created in the C drive root directory.

Once you run that command, you can see an output as follows.

Microsoft (R) .NET Framework Strong Name Utility Version 4.0.30319.33440
Copyright (c) Microsoft Corporation. All rights reserved.
Key pair written to c:\strong.snk



Did I miss anything that you may think that is needed? Did you find this post  useful? I hope you liked this article. Please share with me your valuable suggestions and feedback.

Your turn. What do you think?

A blog isn’t a blog without comments, but do try to stay on topic. If you have a question unrelated to this post, you’re better off posting it on C# Corner, Code Project, Stack Overflow, Asp.Net Forum instead of commenting here. Tweet or email me a link to your question there and I’ll definitely try to help if I can.

Please see this article in my blog here.