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?

Was it helpful?

Solution

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".

OTHER TIPS

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

I'm no VB.NET expert, but have you tried to set the value to for example 1.0.0.*? This should increase the revision number (at least it does in the AssemblyInfo.cs in C#).

The option you select is only to update the setup number. To update the program number you have to modify the AssemblyInfo.

C# [assembly: AssemblyVersion("X.Y.")] [assembly: AssemblyFileVersion("X.Y.")]

VB.NET Assembly: AssemblyVersion("X.Y.*")

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top