2

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?

arb
  • 7,753
  • 7
  • 31
  • 66
Mark Biek
  • 146,731
  • 54
  • 156
  • 201

5 Answers5

1

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

Stu
  • 15,675
  • 4
  • 43
  • 74
  • 1
    This only appears to work in a deployed application. I get a deployment exception when debugging from inside Visual Studio. (Which is fine, easy enough to work around. Just an FYI for others) – Mark Biek Jun 09 '12 at 03:18
1

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

rjzii
  • 14,236
  • 12
  • 79
  • 119
0

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#).

Patrik Svensson
  • 13,536
  • 8
  • 56
  • 77
0

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

Jedi Master Spooky
  • 5,629
  • 13
  • 57
  • 86
0

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.

Community
  • 1
  • 1
Michael Stum
  • 177,530
  • 117
  • 400
  • 535