Automatically incremented revision number doesn't show up in the About Box

Question!

I have a small VB.NET application that I'm working on using the full version of Visual Studio 2005. In the Publish properties of the project, I have it set to Automatically increment revision with each publish.

The issue is that it's only incrementing the revision in the Setup files. It doesn't seem to be updating the version number in the About Box (which is the generic, built-in, About Box template). That version number seems to be coming from My.Application.Info.Version.

What should I be using instead so that my automatically incrementing revision number shows up in the about box?

By : Mark Biek


Answers

Change the code for the About box to

Me.LabelVersion.Text = String.Format("Version {0}", My.Application.Deployment.CurrentVersion.ToString)

Please note that all the other answers are correct for "how do I get my assembly version", not the stated question "how do I show my publish version".

By : Stu


It's a maximum of 65535 for each of the 4 values, but when using 1.0.* or 1.0.*.*, the Assembly Linker will use a coded timestamp (so it's not a simple auto-increment, and it can repeat!) that will fit 65535.

See my answer to this question for more links and details.



It took me a second to find this, but I believe this is what you are looking for:

using System;
using System.Reflection;
public class VersionNumber
{
   public static void Main()
   {
      System.Reflection.Assembly assembly = System.Reflection.Assembly.GetExecutingAssembly();
      Version version = assembly.GetName().Version;
      Console.WriteLine ("Version: {0}", version);
      Console.WriteLine ("Major: {0}", version.Major);
      Console.WriteLine ("Minor: {0}", version.Minor);
      Console.WriteLine ("Build: {0}", version.Build);
      Console.WriteLine ("Revision: {0}", version.Revision);
      Console.Read();
   }
}

It was based upon the code provided at the following site - http://en.csharp-online.net/Display_type_version_number

By : rjzii


This video can help you solving your question :)
By: admin