Assign a Strong Name to a Compiled Third Party Dll

When you go to build your VS project you will get the following error

            ‘Referenced assembly doesn’t have strong name’

So how can I sign/strongly name the dll I hear you ask? Well here’s how:

Step 1

Open the Visual Studio Command Prompt – probably best to copy the dll in into the VC folder to save you having to cd or type a long path in

Step 2

Create a key pair to sign the assembly

– sn.exe –k key.snk

Step 3

Disassemble the dll using

ILDASM   ILDASM.exe    Yourdll.dll   /out=Yourdll.il

This will create a ‘Yourdll.il’ file containing the IL for the assembly. It will also extract the assembly so you will now have a folder  with lots of files, you will also see a .res file containing the resources for the dll.

Step 4

   Reassemble the dll using ILASM to sign the output with the key created above

ILASM.exe Yourdll.il /dll /out=Yourdll2.dll /key=key.snk

Step 5

         Done

Comments