I noticed that when I build a given C# or VB.NET source to produce a DLL, the binary output is different each time. It would be helpful for our build / deployment process if this was not the case. Can I control this?
A timestamp is going to be generated in the file, so you're never going to have complete, bit-for-bit, sameness.
It is probably versioning information in the assemblyinfo file that autoincrement at each build. If you set the version of the assembly manually there should be no difference
Are you doing a Build or a Re-Build?
With a Build the project will be skipped if the source is unchanged (even with auto-increment version *)
------ Build started: Project: ClassLibrary1, Configuration: Debug Any CPU ------
ClassLibrary1 -> C:\Users\schneider\AppData\Local\Temporary Projects\ClassLibrary1\bin\Debug\ClassLibrary1.dll
========== Build: 1 succeeded or up-to-date, 0 failed, 0 skipped ==========
With a Re-Build, everything is rebuilt.
The output is going to be different, I don't think you can control that.
You could probably skip the compilation step for a particular project that didn't get changed and copy an earlier version instead. I wouldn;t recommend it, becuase that kind of defeats the purpose of having a build process. A lot of dev teams automatically have the build process increase the version number, even if there were no changes, just to indicate which build generated the dll.
I'm just curious why you want the output to be the same? Perhaps you're fixing a symptom rather than the cause. If you didn't expect any changes to the output, why start the build in the first place?