Do I increment D whenever a new assembly is created, whether it be a QA assembly or an internal test assembly (i.e. I'm working on some function and I would like to verify that I did not break anything)?
Yes, change your process so that D grows with each row (successful or not), and not with every delivery in QA.
This can be quite difficult if you have several assemblies, some of which work differently and cannot tell them apart, because a failed assembly is the same identifier as a good one, well, in the end. Then you do not even need to consider whether he was on the same day or at the same hour.
Is incrementing a task in an automatic build system?
I would like the build system to automatically increment the build number (D).
After the increment, should I commit the version file? How to avoid a lot of noise in my version control? I do not want tons of "versions to increase."
Version control repository is all about recording detailed noise.
I would have the version update checked, this can make a reasonable shortcut, visible in SVN, from the fact that it creates previous changes where they are included, the build system ignores checks by the build system or those that are defined as a version update commit.
Then, to view the version history, you must have an appropriate tool that allows you to filter the history to show you the desired view, in some cases excluding version commit tags.
If you decide not to fix the version number for each assembly, it might be a good idea to keep the version number in a separate file to avoid accidental updates.
What if the build failed? Still increment version and lock?
Continue to increase the version number, I would not use the version number if it was not successful. You can have many failures outside of the source change in version control that you don’t need to write - server assembly from disk, server crash, the compiler got everything shaky on its knees, building 32 and 64 bits, debugging and freeing aix, linux and windows are being built at the same time ...