Assign a Strong Name to a Third Party Dll

27 02 2009

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

5.Success! 

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 :-)!

Advertisements

Actions

Information

4 responses

1 03 2009
Mike

Just passing by.Btw, your website have great content!

_________________________________
Making Money $150 An Hour

3 02 2011
Bharat

Thanks a Lot For your help..

15 07 2011
Tech Introvert

This 2-year old post saved my sanity today. Thanks!

8 11 2011
Rohit Jain

I am not able to deploy it again ..what can be problems for that?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s




%d bloggers like this: