From Microsoft Developer Guide - Signing Assembly

Happen to read the Microsoft Developer Guide that my colleague received in the Ms Technet in Sunway Pyramid. Found a few useful tips. (well, although this could be easily found in MSDN or by googling) But want to jot it down for my future references.


Create a key pair and sign the assembly


Sign assembly. Run “sn” utility, add the key file by hand, or use IDE to generate strong name.

1. In the solution explorer, double click on the AssemblyInfo.vb and edit.
2. Modify AssemblyTitle and AssemblyDescription lines to be
- < Assembly: AssemblyTitle(“ClassName”) >
- < Assembly: AssemblyDescription(“.NET Version of PhysServer”) >

3. In the solution Explorer, right click project node, choose “Properties”. Click “Common Properties” folder and then “Strong Name” property page. Select box labeled “Generate Strong Name Using”. Click “Generate Key” to generate a key file and add to the project. Click OK then, build.


Register Assembly and create type library

Go to Ms Visual Studio .NET tools shortcut – Command prompt

Type

Regasn /tlb:YourClassLib.tlb YourClassLib.dll

(for deploying application for COM access)

type

tlbexp YourClassLib.dll /out: YourClassLib.tlb

(for converting COM to .NET)

tlbimp MyCOM .dll /out:MyCOMNetSupport.dll

Add Assembly to Global Assembly Cache

Go to Ms Visual Studio .NET tools shortcut – Command prompt

Type

Gacutil /I YourClassLib.dll



Other stuff

The signcode.exe tool embeds a digital certificate in the assembly. This allows users of the assembly to verify the identity of the assembly's developer by using a public or private trust hierarchy.





Comments

Popular posts from this blog

Outlook : "operation failed, object could not be found. " when trying to close a PST.

Troubleshooting Outlook Express (IMAP, POP3, HTTP, NEWS) with the log file

MSSQL GROUP_CONCAT