views:

960

answers:

3

I have an assembly which is not strong-named. I have no source code for it.

I now need it to be signed. Is there a way to do this?

+1  A: 

Use the Strong Name Tool utility (sn.exe).

Joe Chung
sn.exe can't do this,becacuse sn.exe just can re-sign with storng name assembly
guaike
I think sn.exe works if the original assembly is marked to be signed later. yes?
Cheeso
to Cheeso: Yes,you are right,i found a way:http://ryanfarley.com/blog/archive/2010/04/23/sign-a-.net-assembly-with-a-strong-name-without-recompiling.aspx
guaike
+3  A: 

If the original assembly is marked for delayed signing, then you can use the sn.exe tool.

If the original assembly is not so marked, then you can disassemble it with ildasm.exe, then re-asssemble it with ilasm.exe and specify the /key argument.

Cheeso
http://msdn.microsoft.com/en-us/library/xc31ft41(VS.71).aspx MSDN said using:al /out:MyAssembly.dll MyModule.netmodule /keyfile:sgKey.snk . But I did not succeed
guaike
+1  A: 

I just recently wrote up the steps to do this on a blog post. See Sign a .NET Assembly with a Strong Name Without Recompiling

Edit: I just noticed in the comments to another answer that you already found my blog post, oops. :-)

Ryan Farley
Thank you very much!
guaike