Search code examples
visual-studio-2008msbuildcsc

A source compiled with vs2008 produce a binary that is different from the same source compiled directly by csc at command line


I can't understand why If I compile the same source with Visual Studio 2008 (MSBuild) and then with csc (or NANT) at command line I can't obtain exacly the same binary file (the same assembly).

The command line is the same that is invoked by visual studio because I copy the command from the output window and then paste the command to the vs2008 command prompt.

I know that if I compile the same source at different time I obtain different binary because of the timestamps in the assembly metadata. In fact, if I compare two binaries produced by vs2008 at different time I notice small difference between the binary data.

But if I compile with vs and then with csc the binaries are very very different! Do you know why? What's wrong?


Solution

  • There's no guarantee of any particular order of metadata made by the compiler. That said, there's nothing intentionally causing a different ordering between the in-proc compiler and csc.exe.