Auto-incrementing build numbers in Visual Studio

March 13, 2007

One neat feature in Visual Studio I came across today is auto-incrementing build numbers. You can use this to avoid having to configure or write an external tool or version control system just (although you should be using the latter anyway).

To enable it, just open AssemblyInfo.cs in your project, and change the AssemblyVersion setting to [assembly: AssemblyVersion( “1.0.*” )];. Remove the [assembly: AssemblyFileVersion( “” )]; line entirely; it doesn’t support auto incrementing, and you usually don’t need it in the first place.

The next time you build your project, Visual Studio will put its own values in for the build number and revision number. It’s not too important how it generates these; but if you’re wondering, it uses the number of days since Jan. 1st 2000 as the build number, and the number of seconds since midnight number of seconds since midnight divided by 2 as the revision.

Marc Charbonneau is a mobile software engineer in Portland, OR. Want to reply to this article? Get in touch on Twitter @mbcharbonneau.