Reputation: 86
Until now, I compiled my project from VS and now I moved compilation process to a script.
I use vcbuild.exe
with command line parameters for this purpose.
What I see is that my output files is not bytewise similar at all.
I compared a command line from VS and from my script and it's identical down to the last comma, so I really don't understand why it's so different.
Command line identical from VS compilation and from vcbuild
log (line breaks added for clarity):
c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Csc.exe
/noconfig
/unsafe-
/nowarn:1701,1702
/platform:x86
/errorreport:prompt
/define:TRACE
/reference:C:\blahblah.dll
/reference:c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Data.dll
/reference:c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.dll
/reference:c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Windows.Forms.dll
/reference:c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Xml.dll
/debug:pdbonly
/optimize+
/out:obj\x86\Release\blah.exe
/target:winexe
/win32icon:blah.ico
..\..\blah\version.cs
Program.cs
Properties\AssemblyInfo.cs
Upvotes: 1
Views: 261
Reputation: 17622
I'm guessing that you by "binary compatible" mean that your files aren't exactly the same, not that they won't execute in the same way depending on how you invoke the compiler.
The compiler (Csc.exe) adds a timestamp and some other stuff into each compiled file so even if the source is unchanged the files generated from two different compilations won't be an exact match. There is a thread about it here on SO that explains it a bit, Why does C# generate different EXEs for the same source-code?, but I've also read a good blog post on MSDN that talked about this but I can't seem to find it right now.
Upvotes: 0