views:

278

answers:

4

Whenever we recompile an exe or a DLL, its binary image is different even if the source code is the same, due to various timestamps and checksums in the image.

But, our quality system implies that each time a new DLL is published, related validation tests must be performed again (often manually, and it takes a significant amount of time.)

So, our goal is to avoid releasing DLLs that have not actually changed. I.e: having an automatic procedure (script, tool, whatever...) that detect different Dlls based only on meaningful information they contain (code and data), ignoring timestamps and checksum.

Is there a good way to achieve this ?

+1  A: 

Base it off the version information, and only update the version information when you actually make changes.

Joel Lucsy
Do you have a good automated way of updating the version when the source is changed? If it's not automated, you're asking for trouble.
Mark Ransom
Unfortunately I don't.
Joel Lucsy
If you're using Visual Studio check out http://code.msdn.microsoft.com/AssemblyInfoTaskvers
Jarrett Meyer
A: 

Have your build tool build the DLL twice. Whatever differences exist between the two are guaranteed to be the result of timestamps or checksums. Now you can use that information to compare to your next build.

Mark Ransom
Thanks for your answer. Looks like a possible solution, but I wonder if it would fit, actually. Locations (and quantities?) of variable parts may change depending of various segment size (or not?).The solution must also be applicable to a lot of dlls (we have dozens) but detecting the variable locations can probably be also done automaticaly once, by comparing to successive-but-identical builds. Also two different timestamps have chances to generate the same chesksum...
Jem
The variable parts shouldn't change if you have two automated builds from the same source files. Yes, the checksums might have a small chance of being the same... more likely a single byte of the checksum will be the same. So you will have a small chance of a false positive, that's still better than a false negative, and better than the situation you have today.
Mark Ransom
+1  A: 

If you have an automated build system that syncs source before starting a build, only proceed with building and publishing if there any actual changes in source control. You should be able to detect this easily from the output of your source control client.

Michael
Yes this is barely what we did before, but considering source control (or dll version) is far from perfect. Changes in sources do not always generate different DLLs. For example: updating (doxygen) comments, adding functions in header shared by lots of modules, splitting headers... Anyway it implies too much human factors. Probably ok for one progammer, becomes hard with an average team.
Jem
+1  A: 

We have the same problem with our build system. Unfortunately it is not trivial to detect if there are any material code changes since we have numerous static libraries, so a change to one may result in a dll/exe changing. Changes to a file directly used by the dll/exe may just be fixing a bad comment, not changing the resulting object code.

I've looked previously for a tool to do what you desired and I did not see one. My thought was to compare the two files manually and skip the non meaningful differences in the two versions. The Portable File Format is well documented, so I don't expect this to be terribly difficult. Our requirements additional require that we ignore the version stamped into the dll/exe since we uniquely stamp all our files, and also to ignore the signature as we sign all our executables.

I've yet to find time to do any of this, but I'd be interested in collaborating with you if you proceed with implementing a solution. If you do find a tool that does this, please do let us know.

Stephen Nutt
I'm currently exploring a solution involving DumpBin. One of its features is the export of data (code+resources) part only of executables, into text files. DUMPBIN /RAWDATA MyApp.EXE > MyApp.txtSee http://support.microsoft.com/kb/164151/
Jem
I hadn't considered using DumpBin, thanks for the tip. If this works, it will certainly save me much time.
Stephen Nutt