The source code below demonstrates how to automatically increment the build number of an application written in C#.NET. This example applies to Visual Studio 2005 using version 2.0 of the .NET framework, but can be easily modified for other environments.
In the Visual Studio 2005 implementation of C#, the application build number is by default stored within the 'AssemblyInfo.cs' file, which resides within the application's 'Properties' folder. The source code below works by finding the build number within this file, incrementing the build number, and then rewriting the file.