Strongly Naming a Third Party Assembly

At some point in your development career you’ve likely run into some kind of problem caused by working with strong named assemblies (typically by design). Today I was trying to compile my own strong named assembly, but my code was referencing an assembly that wasn’t strongly named. I didn’t have access to the third party assembly code, so recompiling it wasn’t an option. After searching around for a while I found this neat little trick to disassemble and reassemble a dll.

First, use “sn.exe -k myTest.snk” to generate a key for your assembly. Next, use “ildasm myTest.dll /out:myTest.il” to disassemble your dll into IL. Finally, use “ilasm myTest.il /res:myTest.res /dll /key:myTest.snk /out:myTestSN.dll” to reassemble the dll with a strong name. Not necessarily the prettiest solution, but it gets the job done!