Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 155
  • Last Modified:

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
0
Akula
Asked:
Akula
  • 7
  • 5
1 Solution
 
Bob LearnedCommented:
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
0
 
AkulaAuthor Commented:
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
0
 
Bob LearnedCommented:
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
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
AkulaAuthor Commented:
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
0
 
Bob LearnedCommented:
Show me this line from your AssemblyInfo.vb:

<Assembly: AssemblyVersion("1.0.0.0")>

Bob
0
 
AkulaAuthor Commented:

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

<Assembly: AssemblyVersion("2.0.0.0")>

Then, tell me what the BuildNumber returns.

Bob
0
 
AkulaAuthor Commented:
It returns 0
0
 
Bob LearnedCommented:
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
0
 
AkulaAuthor Commented:
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
0
 
Bob LearnedCommented:
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
0
 
Bob LearnedCommented:
This might help:

Managing assembly version numbers using Visual Studio .NET and Visual SourceSafe
http://www.codeproject.com/dotnet/ManagingAssemblyVersions.asp

UpdateVersion
http://code.mattgriffith.net/UpdateVersion/

Bob
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 7
  • 5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now