Search code examples
.netilstrongname

Signing pre-build assemblies


Before I go digging through the IL, hopefully someone has run into this issue before:

Trying to sign a third-party assembly (in this case, the latest HtmlAgilityPack). I've done this before with no issues. Doing the usual ildasm => ilasm, but when I go to use my newly-signed assembly, Visual Studio complains it "cannot enumerate resources in the executable". What might cause this?


Solution

  • I've done it before too. If it's managed only, one pass through Mono.Cecil and Mono.Security can do it.

    If you're in a hurry, disassemble with ildasm, add the public key declaration to the resulting .il file (it's a long text file, reference a disassembled signed assembly for syntax), and recompile with ilasm. Don't forget to relink resources with /res:assemblyname.res.