In connection with improving my build and deploy routines I wish to compare the code of two different assemblies. I cannot compare filesize and created date, or the binary content of the assemblies as these might differ even if the assemblies are logically identical.
In previous projects I have used ildasm.exe and produced a text file for each assembly, and compared these after slight modifications, but I would rather do this in c# code without running Process.Start().
As example I wish to do something like this:
public bool AssemblyComparer(string path1, string path2)
{
var text1 = MagicLibrary.Disassemble(path1);
var text2 = MagicLibrary.Disassemble(path2);
return text1.Equals(text2);
}
Any suggestions as to how to do this will be appreciated.
I haven't used it but as far as I know Mono.Cecil is a library with which you can inspect IL code in your programs from assemblies. See Mono.Cecil by jbevain. But I don't think it's as easy to use as you would like it in your code snippet.