Link to home
Start Free TrialLog in
Avatar of Akula
Akula

asked on

Assembly Version Question

Hello all,
I have a question about the assembly:version.
I have created a help/about box that I show the version of software.
But I really do not like the way VB.Net does it.
I have tried a few things to parse the info I want, but to no avail.
What I want would be to display something of this nature:

Version 1.0 Build 24
And have the build update automaticaly and I would manually control the 1.0, 1.1, 1.2, 2.0, etc

Any ideas?

Thanks,
Akula
Avatar of Bob Learned
Bob Learned
Flag of United States of America image

Look in the AssemblyInfo.vb file, and notice that the version is 1.0.*.  If you want to control the version, then remove the asterisk, and just use 1.0, 1.1, etc.

Bob
Avatar of Akula
Akula

ASKER

Thanks Bob,
I do understatnd that part and I have done that.
What I want to do is the build version.
I can not get it to work the way I like.
I don't like the 4 digit version it uses, I'd rather have a 2 digit version that I am trying to parse, but with no look.

Ak
Are you looking for something like this:

Imports System.Reflection.Assembly

Public Class App

  Public Shared Function MajorVersion() As String

    Return GetExecutingAssembly.GetName.Version.Major

  End Function


  Public Shared Function MinorVersion() As String

    Return GetExecutingAssembly.GetName.Version.Minor

  End Function


  Public Shared Function BuildNumber() As String

    Return GetExecutingAssembly.GetName.Version.Build

  End Function


  Public Shared Function Revision() As String

    Return GetExecutingAssembly.GetName.Version.Revision

  End Function


  Public Shared Function ProductVersion() As String

    Return App.MajorVersion & "." & App.MinorVersion & "." & _
           App.Revision() & "." & App.BuildNumber()

  End Function

End Class


Bob
Avatar of Akula

ASKER

Hi Bob,
That is basically what I wnat and what I have done also.
However, I may have not asked my question properly.
I would like my about box to state :

Version 1.0 Build 17

and then after new build:

Version 1.0 Build 18

But, in the App.BuilderNumber() of your code and mine, it is 4 digits.
I tried to parse it for the first 2 digits, but the digits remained the same while the last 2 were changing.
I realize it will change eventually, but I need a way to do it as listed above.

Any idea?

Thanks,
Ak
Show me this line from your AssemblyInfo.vb:

<Assembly: AssemblyVersion("1.0.0.0")>

Bob
Avatar of Akula

ASKER


<Assembly: AssemblyVersion("2.0.*")>
Change it to:

<Assembly: AssemblyVersion("2.0.0.0")>

Then, tell me what the BuildNumber returns.

Bob
Avatar of Akula

ASKER

It returns 0
And if you change it to Assembly: AssemblyVersion("2.1.0.17")>, you would get v2.1 Build 17.

This is what you need:

Public Shared Function ProductVersion() As String

    Return App.MajorVersion & "." & App.MinorVersion & " " & _
           "Build " & App.BuildNumber()

  End Function


Bob
Avatar of Akula

ASKER

This is good Bob,
But how can this automate the last digit?
It doesn't appear to update when I build when it is this way?
Thanks,
Ak
You are in control of it now, there isn't anything (that I know of) to automatically increment this once you remove the asterisk.

Bob
ASKER CERTIFIED SOLUTION
Avatar of Bob Learned
Bob Learned
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial