views:

1025

answers:

6

I suspect this is going to be a really easy one but I'm a .NET newbie so be gentle.

I have a small VB .NET app 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 # in the About Box (which is the generic, built-in, About Box template). That version # seems to be coming from My.Application.Info.Version.

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

A: 

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
A: 

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
+1  A: 

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
+1  A: 

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

Rob
A: 

@Pratik Be careful with the 1.0.0.*. It has a maximum value I think is 2^16

Conrad
A: 

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.

Michael Stum