2

I have added the Deterministic Flag to the project file for a C++ project, however, when I do a binary compare of the executable, there are still differences between builds with the same source code files. I use this same deterministic flag for my C#/VB.net projects with no issues. Flag:

  <PropertyGroup>
    <Deterministic>true</Deterministic>
  </PropertyGroup>

Are there any other settings that need to be changed for the C++ projects to produce an exact binary from the same source code each build?

I am currently using Visual Studio Professional 2015 Version 14.0.25431.01 Update 3.

Below is an image of the comparison, I am not sure what is at location 0x100 and 0x235A0, but the values at these 2 addresses are the only ones that change from build to build.

Comparison

lakedoo
  • 385
  • 1
  • 4
  • 13
  • 1
    Could it be timestamps? The current unix time in hex starts with 0x5aaf. The one at 0x100 could then be `IMAGE_FILE_HEADER.Time­Date­Stamp`. – Karsten Koop Mar 19 '18 at 14:07
  • 1
    The /deterministic compile option is only implemented by the C# compiler. The linker you use in a C or C++ project has no such option. So you are seeing the timestamp change in the executable file. Again for the debug info section, you can get rid of that one. – Hans Passant Mar 19 '18 at 14:28
  • 1
    I don't understand why this question marked as duplicate, IT'S NOT! the answer is of @HansPassant – Yitzchak Jun 27 '19 at 13:06

0 Answers0