Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

using unsigned assemblies in signed ones

Tags:

c#

.net

found these helpful links curtosy of SO.

http://buffered.io/posts/net-fu-signing-an-unsigned-assembly-without-delay-signing/

How to fix "Referenced assembly does not have a strong name" error?

I follow the process. It seems easy enough to do. Just wondering if there's a point-and-click automated tool that will do this for me -- particularly for the case where unsigned 3rd party A.dll references unsigned B.dll which references unsigned C.dll.

like image 832
sgtz Avatar asked Nov 02 '11 08:11

sgtz


1 Answers

You can sign the assemblies yourself so that you are able to reference them in a project that is also signed if you are unable to get the author to strong sign them for you.

Do this by disassemble the assembly into IL and then reassemble it with your own strong name key file.

Open a Visual Studio command prompt and browse to the directory containing your unsigned assembly. Run the following commands from the command prompt.

ildasm.exe /all /typelist /out=My.Unsigned.Assemby.il My.Unsigned.Assemby.dll

This will create an IL version of the assembly called My.Unsigned.Assemby.il

Next you will need to reassemble this without modification using your strong name key.

ilasm.exe /dll /optimize /key=MyKeyFile.snk My.Unsigned.Assemby.il

You will now end up with the same assembly, just a signed version of it. You can read more about strong name key generation but I assume you already know how to do this based on the question.

UPDATE: I have written an app to do this automatically from a UI, the command-line or programmatically through an API. It handles all the edge cases as well like assembling back to the right version with the correct flags. You can read more about it and download the tool here: http://brutaldev.com/post/2013/10/18/NET-Assembly-Strong-Name-Signer

like image 131
BrutalDev Avatar answered Oct 14 '22 09:10

BrutalDev