How do I sign an assembly that has already been built into the dll, in particular flute.dll

The reason I want to sign the DLL is because I want to add it to the global assembly cache. Assembly is a css parser written in Java and ported to J #. I am using VS2008, so I cannot create J # projects. He does not have a strict name assigned to him, and I have no idea how to do this now that he was built.

Does anyone have any idea?

+21
dll visual-studio-2008
Sep 04 '09 at 15:29
source share
5 answers

After a bit of searching, I found this post that explains one way to do this.

excerpt:

At the VS.NET command prompt, type the following:

  • Create key file: sn -k keyPair.snk
  • Get MSIL for the provided assembly: ildasm providedAssembly.dll / out: providedAssembly.il
  • Rename / relocate the original assembly: ren providedAssembly.dll is provided by Assembly.dll.orig
  • Create a new assembly from MSIL and your KeyFile assembly: ilasm providedAssembly.il/dll/key = keyPair.snk
+39
04 Sep '09 at 15:39
source share

Step 1: Detach the assembly

ildasm myTest.dll /out:myTest.il 

Step 2: Reassemble using a key with a strong name

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

For verification, you can use the following command:

 sn -vf myTestSN.dll 

Hope this helps!

+17
Feb 12 2018-10-12
source share

This link also shows how to do this, including when one of the third-party assemblies that you sign up has a link to another signed assembly without a subscription:

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

Edit: Sorry, link is blocked.

+3
May 24 '12 at 22:40
source share

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

+1
Sep 04 '09 at 18:29
source share

thanks especially PJ8 for sending the answer 8 years ago, which still saved me today. My assembly was supposed to go to the GAC, but depended on SQLite-pcl-net, which is not strong since version 1.3.1, although now it depends on the strong name SQLitePCLRaw.bundle_green. So I had to sign SQLite-pcl-net in order to sign my own assembly in other words. I ended up with a cadle-to-grave.bat file, combined with the information in this post and a few other places that I visited today. The β€œpluses” are 1. that this byte works at the build location you want to sign 2. shows at least a hint of where the three tools can be located on the dev machine. 3. Shows all steps in order. The β€œcon”, of course, is that your mileage may vary depending on where ildasm, ilasm and sn are actually located on your particular PC. Anyway, cheers.

 REM Create a new, random key pair "c:\program files (x86)\microsoft sdks\windows\v8.1a\bin\NETFX 4.5.1 Tools\sn" -k SQLite-net.snk REM Store the key in the container MySQLiteKeys in the strong name Cryptographic Services Provider (CSP). "c:\program files (x86)\microsoft sdks\windows\v8.1a\bin\NETFX 4.5.1 Tools\sn" -i SQLite-net.snk MySQLiteKeys REM Disassemble to Intermediate Language "c:\program files (x86)\microsoft sdks\windows\v8.1a\bin\NETFX 4.5.1 Tools\ildasm" SQLite-net.dll /out:SQLite-net.il REM Rename original file ren SQLite-net.dll SQLite-net.dll.orig REM Reassemble to a strong-named version "c:\Windows\Microsoft.NET\Framework\v2.0.50727\ilasm" SQLite-net.il /dll /key=SQLite-net.snk /out:SQLite-net.dll REM Verify the assembly "c:\program files (x86)\microsoft sdks\windows\v8.1a\bin\NETFX 4.5.1 Tools\sn" -v SQLite-net.dll REM Deletes MySQLiteKeys from the default CSP "c:\program files (x86)\microsoft sdks\windows\v8.1a\bin\NETFX 4.5.1 Tools\sn" -d MySQLiteKeys REM View results pause 
0
Apr 6 '17 at 22:38 on
source share



All Articles