How do I find the build number in C#.NET?

I am deploying a WinForms application and need to display the build number so I can track the version on a particular machine.

How do I get the build number form C#.NET?

I don't care if every time I build the program it increments by one, so that the build number increase by more than one from one release to the next.  In fact, I'd prefer that.

So where do I get this data from C#.NET??

newbiewebSr. Software EngineerAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Peter HartCommented:
the build number is what you yourself (or the coders) hve to define and put somewhere.
so every time you build /compile the software someone has to increment the build number
near the version number of your software build.
newbiewebSr. Software EngineerAuthor Commented:
How do you suggest doing this?  I want it to be automatic, otherwise I wil forget to do it.

Do I need to create a database table, for example?  Write to it and read from it?

Any other ways?

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Amazon Web Services

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

newbiewebSr. Software EngineerAuthor Commented:
I presume the AssmeblyName is the name of the executable?

I am looking for the build number.  Know how to get that??

AssemblyName is actually a class that represents all of the identity of the exe or dll. It contains a property called Version which contains the version information, which will be something like 1.0.5677.45677. I am not sure exactly what you mean by build number, but if your version number is something like that, then the last 2 numbers are the timestamp when the build occurred, which is automatically set when building. This is controlled by the AssemblyVersion attribute in the AssemblyInfo file, which would be something like:


where the * means set automatically.

Peter HartCommented:
see chapter 5 of the following:
you the builder have to specify the build number :
every time you build part ofthe update process (as well as versioning all files ofthe project) would be to increment the build number.
you can use also this command:

 you can also get major and minor version number using the static properties in this class


It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.