Signing your assembly, newbie guide
Follow these easy steps. The first 4 steps you only have to do ONCE in your life. Step 5-7 you only have to do ONCE per project.
- Open a command prompt
- Type vsvars32.bat (enter) or navigate to the .NET bin dir
- Type: sn -k mykey.key (enter)
- Move mykey.key to a folder where it gets backupped daily, for example: c:\myfiles\keys\
- Open your code's solution in Visual Studio.NET
- Open the AssemblyInfo class in the editor
- For the attribute AssemblyKeyFile(), specify instead of the default "", the full path of your key, in our example this is "c:\myfiles\keys\mykey.key", so the attribute in full will be:
C#: [assembly: AssemblyKeyFile("c:\\myfiles\\keys\\mykey.key")]
VB.NET: <Assembly: AssemblyKeyFile("c:\myfiles\keys\mykey.key")> - Compile your solution. After compilation, your assembly is signed with your strong key.
- To congratulate yourself with this big achievement, walk to the fridge and pop open a fresh Heineken.
*Pfew* I have to lay down now to take some rest after this long, thorough lecture. Sorry people, but you don't need a plugin which requires registration to do this easy stuff. If you can program software, you can sign your assembly. If not, what are you doing near that keyboard? ;)
The signed assembly can be freely distributed to your clients/customers. They can reference it in their .NET projects without having to worry about public keys, public tokens or other hard to understand material. The world is already very complex, let's not make the easy stuff look like it's very complex also.
Update: Thanks to 'Prima Donna' Robert Mclaws for pointing to a typo in the title.
Kereltje, zodra jij zo goed Nederlands lult als ik Engels, heb je recht van spreken.