Determine whether .NET assemblies were built from the same source

前端 未结 7 1121
独厮守ぢ
独厮守ぢ 2020-12-02 17:38

Does anyone know of a way to compare two .NET assemblies to determine whether they were built from the \"same\" source files?

I am aware that there are some differen

7条回答
  •  醉酒成梦
    2020-12-02 17:49

    When comparing class libraries with ILDasm v4.0.319.1, it seems that image base is not initialized. To avoid mismatches, use a revised solution:

    ildasm /all /text assembly.dll
    | find /v "// Time-date stamp:"
    | find /v "// MVID:"
    | find /v "// Checksum:"
    | find /v "// Image base:"
    > assembly.dasm
    

    Entry point (image base) is actually interesting information for executable assemblies, and will have to be verified carefully. Injecting a new image base is a common way to make a program do something entirely else. In my case, I am trying to verify consistency of multi-threaded builds, so it's safe to skip over the entry point.

    A note on performance: I took an 8MB DLL that was built for AnyCPU, and ran ILDasm. Resulting file was 251MB in size and took several minutes to make. Roughly 32x the size was produced.

提交回复
热议问题