Visual Studio: Auto-increment Build Number – Part 1/3

Visual Studio: Auto-increment Build Number – Part 1/3

There have been two continuous coding focused posts related to DateTime (here and here). I am changing gear in this post to project configuration in Visual Studio.

What

 

Some points to note before we start. I will keep this example to VS2010  (but i don’t see any reason why this trick can’t be applied to VS2012 or 2013) . This setup does not involve any add-ins or installations. I will provide complete code which requires to just make a little change in target project setup and the setup will be ready to go. This setup should work whether or not you have any sourcecontrol – GIT, VSS, TFS – connected to your project.

If you are my type you would wish to tag your builds and deliverable incrementally. For large teams and pro grade development environment there are advanced solutions available to automate the process. But what about indie developers? I don’t know why “*” in build field in Project setting does not auto-increment it but it did not work for me in VS2010 pro, WP project. Even if it did, it serves no practical purpose for the lack of control. Also, for no-frill setup there are some VS Add-ins available which provide auto-increment build capabilities. I tried them and some totally did not work (VS broke) and others had severe lack of functionality. So let’s see what I want this setup to do.

Increment My Build Number

  • Automatically, transparently increment build number of my project, any project.
  • Let me control, through setting, when to increment build – Debug | Release | (other)
  • Ability to start from a custom number
  • Let me reset the build number

Report me

  • Complete Version Number
  • Date and time of the build
  • Configuration – Release | Debug
  • Special property
  • Life expectancy on Mars. (Really? No, just kidding)

Record It

  • Keep the history of all my builds
  • Easily edit/clear the history
  • Manageable text file

Fill It | Shut It | Forget It

(If you are not from India or below 25, you might not get this title. And it does not make any difference)

  • Easy to setup
  • Easy control
  • Extensible
  • Bare, no frill code

Ok, enough of all this requirement overload. Show me the code.

[contd…Part 2]

Happy increment-ing!

Advertisements

5 thoughts on “Visual Studio: Auto-increment Build Number – Part 1/3

    • I hope you would like part 3 of this post where you can download all the code and get auto-increment running. I think, the setup does fulfill the wishlist. Your feedback is very welcome. Thanks for stopping by and commenting.

  1. Pingback: Auto-increment Build Number-Part 3/3 | Sharp Statements

  2. Pingback: Auto-increment Build Number – Part 2/3 | Sharp Statements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s