# Generating a Build.Number File for NAnt

If you use NAnt to manage your build cycle, there’s a great extension called NAntContrib. It has a bunch of extension tasks to help manage your build more easily.

Among them is the awesome tag, which allows you to automatically increment your version number every build. To add it, simply add into your target:

Run NAnt, and viola! You’re presented with this un-helpful and frustrating error message:

 Unable to read version number from "build.number". Could not find file 'build.number'. 

Worse yet, creating an empty build.number file makes NAnt tell you the format is invalid. And googling reveals nothing.

As it turns out, the enigmatic format required is very simple: it’s a four-part version number typical of .NET assemblies. Simply start off with 1.0.0.0 and your build works. Hooray! Thanks for nothing, NAnt!

Ashiq has been coding C# since 2005. A desktop, web, and RIA application developer, he's touched ASP.NET MVC, ActiveRecord, Silverlight, NUnit, and all kinds of exciting .NET technologies. He started C# City in order to accelerate his .NET learning.
This entry was posted in Tools and tagged , , . Bookmark the permalink.

### 2 Responses to Generating a Build.Number File for NAnt

1. pranav says:

Hi,

I still get the same error, even after installing NantContrib extension.
Can you tell me where I have to install NantContrib?

2. Ashiq Alibhai, PMP says:

@pranav sorry, I don’t know. If it’s not in the right directory, NAnt will complain that it can’t find C:\Some\path\to\NAntContrib.dll. That should suffice.