comparing products of builds in release

ⅰ亾dé卋堺 提交于 2019-12-03 18:05:34

问题


I need to compare build outputs of VS2005 in order to be sure I can reproduce the exact same product.

when I do two builds one after the other in release and compare the produced files I get different files, doing text comparison it seems that more than just the datetime is different

how can I build in order to reproduce exact same product each time ?


回答1:


Whenever you build, the compiler embeds:

  • The date and time
  • A GUID (used for debugging etc, I believe)
  • Potentially the assembly version (which may have "1.2.3.*" and populated automatically)
  • Potentially a strong hash

A couple of options:

  • Find out where the files are "known to differ immaterially", wipe those bytes, and then compare
  • Use ildasm to convert the assemblies to text, and then compare those results. (I haven't checked whether or not this reveals the differences too - it may do, in which case again you'd have to explicitly ignore certain sections)

This problem does pop up every so often, so I'll see if I can come up with a tool to do the comparisons - although it's unlikely to cope with signed assemblies, as the location of the signature could vary significantly.




回答2:


One question: you did text comparison for binary build outputs? As I know most of compilers never produces binary identical build output for the same project. Compiler encodes into binary time of compilation, special ordinal, etc.




回答3:


You can actually use DumpBin to do binary comparisons of different builds that ignore the per-build variations. See How to compare binary images of the same project builds. The article says it applies only up to Visual Studio 6, so I am not sure it will work for 2005 or beyond..



来源:https://stackoverflow.com/questions/319864/comparing-products-of-builds-in-release

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!