So here is the scenario – you get a .net dll from somewhere that contains some cool functionality you wish to use in your SharePoint application. The probem is that you cant sign your own application dll because the referenced third party dll is not signed or strongly named.
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:
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
2.Create a key pair to sign the assembly – sn.exe –k key.snk
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.
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
You should now have a signed version of the dll, you can now add this to your VS project or deploy to the GAC etc :-)!