tags:

views:

88

answers:

6

I have the source for a DLL and I have a compiled version of it lying around somewhere.

If I compile the source it will have a different date to the already-compiled version.

How can I tell whether they are in fact the same and have merely been compiled at different times?

A: 

The basic comparison is of version and size of the DLL. Also, you can check if any file has a modified date beyond the date of the compiled dll.

Kangkan
See my question. If I compile the source it will have a different date to the already-compiled version.
Craig Johnston
@Craig: If you read carefully, I mentioned that the last modified date of the source code file(s) should not be beyond the original dll's date. Of course, if the code has been saved with any change not in the functionality, then also the date of modification will change. It is sure that if you compile the new dll will have a different date. Its trivial.
Kangkan
OK, I see your point now. Yes, it would be good idea to look at the modified date of the source files.
Craig Johnston
A: 

why can't you use the 'modified date' ?

Sunil Ramu
Because the modified date of the compiled DLL will be earlier than the modified date of the DLL that I create from the source code now.
Craig Johnston
A: 

You can use .NET Reflector to Disassamble the dll and compare it to the last code change you made to see if they are the same. If they are they you know that they are based on the same code.

Mharlin
+1  A: 

what about md5 hash?

nWorx
I am worried about any GUID, key or other codes that may be changed everytime the DLL is compiled. Are there any of these?
Craig Johnston
A: 

compare the files in binary mode. Run the following from the command line:

fc /b file1.dll file2.dll

That will let you know if the files are identical, but they will probably not be unless they are compiled in exactly the same conditions, which, since you have the source code, is possible.

gmagana
+1  A: 

Both NDepend and a Plugin for Reflector allow you to compare assemblies.

Christian.K