423,688 Members | 1,894 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 423,688 IT Pros & Developers. It's quick & easy.

Version number

P: n/a
How to get the current version number of my app so i can put it at the title
bar?

TIA

Nov 21 '05 #1
Share this Question
Share on Google+
9 Replies


P: n/a
Nikolay,

\\\
MessageBox.Show( _
System.Reflection.Assembly.GetExecutingAssembly( _
).GetName().Version.ToString())
'or
MessageBox.Show( _
System.Windows.Forms.Application.ProductVersion)
///

I hope this helps a little bit?

Cor
"
Nov 21 '05 #2

P: n/a
Nikolay,

\\\
MessageBox.Show( _
System.Reflection.Assembly.GetExecutingAssembly( _
).GetName().Version.ToString())
'or
MessageBox.Show( _
System.Windows.Forms.Application.ProductVersion)
///

I hope this helps a little bit?

Cor
"
Nov 21 '05 #3

P: n/a
Hello,

I use the following line:-

Me.Text = String.Format("{0} ({1})", Me.Text,
Reflection.Assembly.GetExecutingAssembly().GetName .Version)

And then in assemblyinfo.vb have the version number set automatically or
override it yourself etc.

Hope this helps,
Regards
Simon Jefferies
mailto:simon[nospam]@cooltoolsonline.co.uk
-- remove [nospam] to email me --
"Nikolay Petrov" <jo**************@mail.bg> wrote in message
news:ec**************@TK2MSFTNGP11.phx.gbl...
How to get the current version number of my app so i can put it at the
title bar?

TIA

Nov 21 '05 #4

P: n/a
Hello,

I use the following line:-

Me.Text = String.Format("{0} ({1})", Me.Text,
Reflection.Assembly.GetExecutingAssembly().GetName .Version)

And then in assemblyinfo.vb have the version number set automatically or
override it yourself etc.

Hope this helps,
Regards
Simon Jefferies
mailto:simon[nospam]@cooltoolsonline.co.uk
-- remove [nospam] to email me --
"Nikolay Petrov" <jo**************@mail.bg> wrote in message
news:ec**************@TK2MSFTNGP11.phx.gbl...
How to get the current version number of my app so i can put it at the
title bar?

TIA

Nov 21 '05 #5

P: n/a
Assembly.GetExecutingAssembly().GetName().Version

"Nikolay Petrov" <jo**************@mail.bg> wrote in message
news:ec**************@TK2MSFTNGP11.phx.gbl...
How to get the current version number of my app so i can put it at the title
bar?

TIA


Nov 21 '05 #6

P: n/a
Assembly.GetExecutingAssembly().GetName().Version

"Nikolay Petrov" <jo**************@mail.bg> wrote in message
news:ec**************@TK2MSFTNGP11.phx.gbl...
How to get the current version number of my app so i can put it at the title
bar?

TIA


Nov 21 '05 #7

P: n/a
"Nikolay Petrov" <jo**************@mail.bg> schrieb:
How to get the current version number of my app so i can put it at the
title bar?


Structure of version numbers and methods to determine the version number
<URL:http://dotnet.mvps.org/dotnet/faqs/?id=versioning&lang=en>

Notice that it's not best practice to put the version number into the title
bar. Instead, display the version number in the about dialog.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #8

P: n/a
"Nikolay Petrov" <jo**************@mail.bg> schrieb:
How to get the current version number of my app so i can put it at the
title bar?


Structure of version numbers and methods to determine the version number
<URL:http://dotnet.mvps.org/dotnet/faqs/?id=versioning&lang=en>

Notice that it's not best practice to put the version number into the title
bar. Instead, display the version number in the about dialog.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #9

P: n/a
Nikolay,
In addition to the other comments:

The "easiest" way in VB.NET to get the Version number of a VB.NET Windows
Application is to use Application.ProductVersion, Application is found in
the System.Windows.Forms namespace.

To get the "product" Version of individual Assemblies I use the following
code to get the product version of specific assemblies:

Private Function GetProductVersion(ByVal [assembly] As
System.Reflection.Assembly) As String
Dim attributes() As Object
attributes =
[assembly].GetCustomAttributes(GetType(System.Reflection.Ass emblyInformationalVersionAttribute),
False)
If attributes.Length > 0 Then
Dim assemblyProductVersion As
System.Reflection.AssemblyInformationalVersionAttr ibute =
DirectCast(attributes(0),
System.Reflection.AssemblyInformationalVersionAttr ibute)
Return assemblyProductVersion.InformationalVersion
Else
Return String.Empty
End If
End Function
Similarly there is a Application.ProductName that will get the name of your
Product, Application.ProductName returns the value of the
AssemblyProductAttribute found in the AssemblyInfo.vb file of your project.
If you leave this attribute its default value of blank then you get the root
namespace of the project. However if you change the attribute's value then
you will get the new value.

I normally change the AssemblyProductAttribute to a displayable value & use
Application.ProductName as my message box titles.

Note Application.ProductVersion comes from the
AssemblyInformationalVersionAttribute if you add it to your AssemblyInfo.vb
file, if you do not add AssemblyInformationalVersion, then
Application.ProductVersion comes from the AssemblyVersionAttribute:

For example, if my root namespace is "TheGreatAndWonderfulApp", I might set
my AssemblyInfo.vb file as:

' somewhere in the AssemblyInfo.vb file:
....
<Assembly: AssemblyProduct("The Great & Wonderful Application")>
....
<Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyInformationalVersion("1.0.0")> ' Product Version

Hope this helps
Jay

"Nikolay Petrov" <jo**************@mail.bg> wrote in message
news:ec**************@TK2MSFTNGP11.phx.gbl...
How to get the current version number of my app so i can put it at the
title bar?

TIA

Nov 21 '05 #10

This discussion thread is closed

Replies have been disabled for this discussion.