• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 4998
  • Last Modified:

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??

thanks,
newbieweb
0
newbieweb
Asked:
newbieweb
  • 2
  • 2
  • 2
  • +1
3 Solutions
 
chilternPCCommented:
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.
0
 
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?
0
 
Z_BeeblebroxCommented:
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
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??

newbieweb
0
 
Z_BeeblebroxCommented:
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:

 [assembly:AssemblyVersion("1.0.*")]

where the * means set automatically.

Zaphod.
0
 
chilternPCCommented:
see chapter 5 of the following:
http://www.akadia.com/services/dotnet_assemblies.html#Version%20Control%20and%20Linking
you the builder have to specify the build number :
[assembly:AssemblyKeyFile("app.snk")]
[assembly:AssemblyVersion("1.0.0.0")]
every time you build part ofthe update process (as well as versioning all files ofthe project) would be to increment the build number.
0
 
dev_osamaCommented:
you can use also this command:

Environment.Version.ToString();
 you can also get major and minor version number using the static properties in this class

Environment.Version.Major;
Environment.Version.MajorRevision;
Environment.Version.Minor;
Environment.Version.MinorRevision;
Environment.Version.Revision;


regards,
O.Zain
0

Featured Post

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

  • 2
  • 2
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now