0

I'm trying to sign a set of DLLs through this process:

  • ildasm the original DLL to IL
  • ilasm (and Strong Naming) the IL back to DLL

Each of the DLLs, seen thorugh Visual Studio Object Browser, is correct, but if a rebuilt DLL refers to an object in another rebuilt DLL (e.g. extending an object defined in it), then the reference cannot be resolved. References to System assemblies are correctly resolved.

Can someone tell me why?

I'm using .Net SDK v2 with x86 architecture.

svick
  • 236,525
  • 50
  • 385
  • 514
Andrea Colleoni
  • 5,919
  • 3
  • 30
  • 49
  • 2
    This is probably due to the "FQN" referencing. Since the FQN has changed (it now has something else than PublicKeyToken=null) it is considered another library and anything pointing to the library with a publickeytoken of null will not be able to find the new libraries. – Marvin Smit Oct 02 '13 at 14:10
  • Ok. I think you're right Marvin; this explains well my situation thank you. But now how can I correct references in a newly signed assembly to another newly signed assembly. Can I? – Andrea Colleoni Oct 02 '13 at 14:19
  • Sorry i couldn't reply any sooner. (Standing infront of a class atm) But i see you found the way to modify the references in the assembly information headers :). – Marvin Smit Oct 02 '13 at 15:46

1 Answers1

1

Based on useful Marvin Smit comment I tried to edit .il files generated by ildasm.exe and found a solution.

Opening .il files in a text editor, the first lines of the file show references to external assemblies:

.assembly extern MY_EXT_ASSEMBLY
{
    .ver 10:0:1:0
}

I changed every occurence of these references to this:

.assembly extern MY_EXT_ASSEMBLY
{
    .publickeytoken = (4B DC CA FF 2F A8 6D EE )
    .ver 10:0:1:0
}

Where the value of the .publickeytoken property is found via the following command (form SDK):

sn -T MY_EXT_ASSEMBLY.dll

This should give a result as follows:

Public key token is 4bdccaff2fa86dee.

I rebuilt my VS solution and everithing compiled.

Andrea Colleoni
  • 5,919
  • 3
  • 30
  • 49