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 strong name, we will define what exactly strong name is. I hope you will like this.
What is strong name?
Basically strong name is a container which consists of assembly’s informations. For example it contains, name of the assembly, culture informations, version number, public key, digital signature. It can be generated by 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 informations 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 short cuts from the directory as
[html]
C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\Tools\Shortcuts
[/html]
Or you can go to start->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 below command in the command prompt.
[html]
C:\Program Files (x86)\Microsoft Visual Studio 12.0\SDK\v3.5\Bin>sn -k "c:\stron
g.snk
[/html]
Here, the visual studio and framework versions will be changed as your version. And the stron name strong.snk will be created in the C drive root directory.
Once you run that command, you can see an output as follows.
[html]
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
[/html]
Conclusion
Did I miss anything that you may think which is needed? Could you find this post as useful? I hope you liked this article. Please share 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.
Kindest Regards
Sibeesh Venu