Question

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.

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top