views:

389

answers:

4

The reason I want to sign the dll is because I want to add it to the Global Assembly Cache. The assembly is a css parsing engine written in Java and ported to J#. I use VS2008 so I can't make J# projects. It doesn't have a strong name key assigned to it and I have no idea how to do it now that it's built.

Anyone have any ideas?

+5  A: 

After a little searching, I found this post that explains one way of doing it.

Exerpt:

From a VS.NET command prompt, enter the following:

  1. Generate a KeyFile: sn -k keyPair.snk
  2. Obtain the MSIL for the provided assembly: ildasm providedAssembly.dll /out:providedAssembly.il
  3. Rename/move the original assembly: ren providedAssembly.dll providedAssembly.dll.orig
  4. Create a new assembly from the MSIL output and your assembly KeyFile: ilasm providedAssembly.il /dll /key= keyPair.snk
PJ8
I've tried getting that to work before and was unable, can you explain how
Stephen lacy
I've edited my answer with a different approach.
PJ8
thanks loads, worked like a charm :)
Stephen lacy
A: 

The Strong Name tool can re-sign an existing assembly, using the -R option. However, from what I understand, the assembly has to be previously signed or delay-signed... not sure you can use it with an unsigned assembly, but you can give it a try

Thomas Levesque
A: 

Not an answer but...:

Are you trying to run AntiSamy? I'm having issues deploying Flute.dll to Windows Server 2003. It's logged as a bug on the AntiSamy .NET google code wiki but I don't think there's a resolution to this issue. Did adding it to the GAC work?

Bryant
First of all, this shouldn't be an answer but rather a comment.Secondly yes, it's antisamy I was using and adding flute.dll to the GAC solved my problem. Good luck.
Stephen lacy
A: 

Step 1: Dis-assemble the assembly

ildasm myTest.dll /out:myTest.il 

Step 2: Re-Assemble using your strong-name key

ilasm myTest.il /res:myTest.res /dll /key:myTest.snk /out:myTestSN.dll 

For verification you can use following command:

sn -vf myTestSN.dll

Hope this helps!

Jeremy E