Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
248 views
in Technique[技术] by (71.8m points)

c# - using unsigned assemblies in signed ones

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...