473,796 Members | 2,578 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Get Version Number

I have a VB project with a setup project in the same solution. Each time I
rebuild the setup project, I change the Version number in the setup
project's properties. Is there any way for my VB project to retrieve this
number?
Nov 21 '05 #1
5 8314
Hi,

Application.Pro ductVersion

http://msdn.microsoft.com/library/de...rsiontopic.asp

Ken
------------------
"Nathan" <nk************ *********@softh ome.net> wrote in message
news:u8******** ******@tk2msftn gp13.phx.gbl...
I have a VB project with a setup project in the same solution. Each time I
rebuild the setup project, I change the Version number in the setup
project's properties. Is there any way for my VB project to retrieve this
number?

Nov 21 '05 #2
Application.Pro ductVersion does not give me the value I enter for the
Version property of the setup project. I entered 1.0.14. It gives me
1.0.1882.11172.

"Ken Tucker [MVP]" <vb***@bellsout h.net> wrote in message
news:OT******** ******@TK2MSFTN GP14.phx.gbl...
Hi,

Application.Pro ductVersion

http://msdn.microsoft.com/library/de...rsiontopic.asp

Ken
------------------
"Nathan" <nk************ *********@softh ome.net> wrote in message
news:u8******** ******@tk2msftn gp13.phx.gbl...
I have a VB project with a setup project in the same solution. Each time
I
rebuild the setup project, I change the Version number in the setup
project's properties. Is there any way for my VB project to retrieve this
number?

Nov 21 '05 #3
Nathan,
I don't know of a way to retreive the setup project version number.

What I do is manually (explicitly) set the setup project version to the same
value as the AssemblyInforma tionalVersionAt tribute in my AssemblyInfo.vb
file.
The "easiest" way in VB.NET to get the Version number of a VB.NET Windows
Application is to use Application.Pro ductVersion, 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 GetProductVersi on(ByVal [assembly] As
System.Reflecti on.Assembly) As String
Dim attributes() As Object
attributes =
[assembly].GetCustomAttri butes(GetType(S ystem.Reflectio n.AssemblyInfor mationalVersion Attribute),
False)
If attributes.Leng th > 0 Then
Dim assemblyProduct Version As
System.Reflecti on.AssemblyInfo rmationalVersio nAttribute =
DirectCast(attr ibutes(0),
System.Reflecti on.AssemblyInfo rmationalVersio nAttribute)
Return assemblyProduct Version.Informa tionalVersion
Else
Return String.Empty
End If
End Function
Similarly there is a Application.Pro ductName that will get the name of your
Product, Application.Pro ductName returns the value of the
AssemblyProduct Attribute 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 AssemblyProduct Attribute to a displayable value & use
Application.Pro ductName as my message box titles.

Note Application.Pro ductVersion comes from the
AssemblyInforma tionalVersionAt tribute if you add it to your AssemblyInfo.vb
file, if you do not add AssemblyInforma tionalVersion, then
Application.Pro ductVersion comes from the AssemblyVersion Attribute:

For example, if my root namespace is "TheGreatAndWon derfulApp", 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: AssemblyInforma tionalVersion(" 1.0.0")> ' Product Version

Hope this helps
Jay
"Nathan" <nk************ *********@softh ome.net> wrote in message
news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
Application.Pro ductVersion does not give me the value I enter for the
Version property of the setup project. I entered 1.0.14. It gives me
1.0.1882.11172.

"Ken Tucker [MVP]" <vb***@bellsout h.net> wrote in message
news:OT******** ******@TK2MSFTN GP14.phx.gbl...
Hi,

Application.Pro ductVersion

http://msdn.microsoft.com/library/de...rsiontopic.asp

Ken
------------------
"Nathan" <nk************ *********@softh ome.net> wrote in message
news:u8******** ******@tk2msftn gp13.phx.gbl...
I have a VB project with a setup project in the same solution. Each time
I
rebuild the setup project, I change the Version number in the setup
project's properties. Is there any way for my VB project to retrieve
this
number?


Nov 21 '05 #4
Thanks, Jay. That explains things a bit.

"Jay B. Harlow [MVP - Outlook]" <Ja************ @msn.com> wrote in message
news:%2******** ********@TK2MSF TNGP14.phx.gbl. ..
Nathan,
I don't know of a way to retreive the setup project version number.

What I do is manually (explicitly) set the setup project version to the
same value as the AssemblyInforma tionalVersionAt tribute in my
AssemblyInfo.vb file.
The "easiest" way in VB.NET to get the Version number of a VB.NET Windows
Application is to use Application.Pro ductVersion, 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 GetProductVersi on(ByVal [assembly] As
System.Reflecti on.Assembly) As String
Dim attributes() As Object
attributes =
[assembly].GetCustomAttri butes(GetType(S ystem.Reflectio n.AssemblyInfor mationalVersion Attribute),
False)
If attributes.Leng th > 0 Then
Dim assemblyProduct Version As
System.Reflecti on.AssemblyInfo rmationalVersio nAttribute =
DirectCast(attr ibutes(0),
System.Reflecti on.AssemblyInfo rmationalVersio nAttribute)
Return assemblyProduct Version.Informa tionalVersion
Else
Return String.Empty
End If
End Function
Similarly there is a Application.Pro ductName that will get the name of
your
Product, Application.Pro ductName returns the value of the
AssemblyProduct Attribute 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 AssemblyProduct Attribute to a displayable value &
use
Application.Pro ductName as my message box titles.

Note Application.Pro ductVersion comes from the
AssemblyInforma tionalVersionAt tribute if you add it to your
AssemblyInfo.vb
file, if you do not add AssemblyInforma tionalVersion, then
Application.Pro ductVersion comes from the AssemblyVersion Attribute:

For example, if my root namespace is "TheGreatAndWon derfulApp", 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: AssemblyInforma tionalVersion(" 1.0.0")> ' Product Version

Hope this helps
Jay
"Nathan" <nk************ *********@softh ome.net> wrote in message
news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
Application.Pro ductVersion does not give me the value I enter for the
Version property of the setup project. I entered 1.0.14. It gives me
1.0.1882.11172.

"Ken Tucker [MVP]" <vb***@bellsout h.net> wrote in message
news:OT******** ******@TK2MSFTN GP14.phx.gbl...
Hi,

Application.Pro ductVersion

http://msdn.microsoft.com/library/de...rsiontopic.asp

Ken
------------------
"Nathan" <nk************ *********@softh ome.net> wrote in message
news:u8******** ******@tk2msftn gp13.phx.gbl...
I have a VB project with a setup project in the same solution. Each
time I
rebuild the setup project, I change the Version number in the setup
project's properties. Is there any way for my VB project to retrieve
this
number?



Nov 21 '05 #5
Thanks, Jay. That explains things a bit.

"Jay B. Harlow [MVP - Outlook]" <Ja************ @msn.com> wrote in message
news:%2******** ********@TK2MSF TNGP14.phx.gbl. ..
Nathan,
I don't know of a way to retreive the setup project version number.

What I do is manually (explicitly) set the setup project version to the
same value as the AssemblyInforma tionalVersionAt tribute in my
AssemblyInfo.vb file.
The "easiest" way in VB.NET to get the Version number of a VB.NET Windows
Application is to use Application.Pro ductVersion, 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 GetProductVersi on(ByVal [assembly] As
System.Reflecti on.Assembly) As String
Dim attributes() As Object
attributes =
[assembly].GetCustomAttri butes(GetType(S ystem.Reflectio n.AssemblyInfor mationalVersion Attribute),
False)
If attributes.Leng th > 0 Then
Dim assemblyProduct Version As
System.Reflecti on.AssemblyInfo rmationalVersio nAttribute =
DirectCast(attr ibutes(0),
System.Reflecti on.AssemblyInfo rmationalVersio nAttribute)
Return assemblyProduct Version.Informa tionalVersion
Else
Return String.Empty
End If
End Function
Similarly there is a Application.Pro ductName that will get the name of
your
Product, Application.Pro ductName returns the value of the
AssemblyProduct Attribute 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 AssemblyProduct Attribute to a displayable value &
use
Application.Pro ductName as my message box titles.

Note Application.Pro ductVersion comes from the
AssemblyInforma tionalVersionAt tribute if you add it to your
AssemblyInfo.vb
file, if you do not add AssemblyInforma tionalVersion, then
Application.Pro ductVersion comes from the AssemblyVersion Attribute:

For example, if my root namespace is "TheGreatAndWon derfulApp", 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: AssemblyInforma tionalVersion(" 1.0.0")> ' Product Version

Hope this helps
Jay
"Nathan" <nk************ *********@softh ome.net> wrote in message
news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
Application.Pro ductVersion does not give me the value I enter for the
Version property of the setup project. I entered 1.0.14. It gives me
1.0.1882.11172.

"Ken Tucker [MVP]" <vb***@bellsout h.net> wrote in message
news:OT******** ******@TK2MSFTN GP14.phx.gbl...
Hi,

Application.Pro ductVersion

http://msdn.microsoft.com/library/de...rsiontopic.asp

Ken
------------------
"Nathan" <nk************ *********@softh ome.net> wrote in message
news:u8******** ******@tk2msftn gp13.phx.gbl...
I have a VB project with a setup project in the same solution. Each
time I
rebuild the setup project, I change the Version number in the setup
project's properties. Is there any way for my VB project to retrieve
this
number?



Nov 21 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
6629
by: Tom | last post by:
I have two version numbers - one for my application and another from a manifest, database, whatever - that isn't important. Now that I have these two version numbers (in the form major.minor.build.revision) I want to compare one to see if it is less than the other. Is there any calculation I can do to convert a version number to a 'real' number so that I can compare it easily? I've fiddled around with various methods but nothing works...
9
6287
by: Nikolay Petrov | last post by:
How to get the current version number of my app so i can put it at the title bar? TIA
2
3501
by: Cary | last post by:
In my project, I want to display the version number on the splash screen and in the help section of my application. I have a variable I created called appVersion. When I go to my deployment project properties, the Version number is there. Is there a line of code that I can use where I can assign the version number to the appVersion variable, something like "appVersion=system.deploymentapp.properties.version" but that actually works? Many...
0
1108
by: moondog | last post by:
I would like my project to have its version numbers in the 1.2.3.4 format; however, whenever I change the "version" property in my setup deployment project I get this error "C:\myprogram\Setup_Projects\xyz\Setup - xyz.vdproj Invalid product version '1.2.3.4'. Must be of format '##.##.####' It does accept a version number with only two decimal points: 1.2.34 However, my company would like to see a four number format version number:...
0
1924
by: ev951 | last post by:
I am not that familiar with XML or XSL and I am trying to sort application version number strings in an XML file that my team uses for application installations on our Linux servers. I have tried the xsl:data-type=number, but that doesn't work. The output of the XML file is exactly what the XML file has and I would like to sort it by the number value. Below is the some of the output from the XML file. <?xml version="1.0"?>...
0
1466
by: newbie73 | last post by:
OS: Vista Python 2.5.2.2 (ActiveState Software Installation) Running latest Cygwin release The error generated is pasted below - please help. - Luis ***************************************
6
2597
by: John | last post by:
I have written a VB.NET DLL that is called by a third party program. If I make any changes in the DLL and then try to replace my DLL file the third party program will abort, saying that the DLL version number does not match to the DLL that it was linked against. How can I recompile my DLL without incrementing the version number? I don't see where this "version number" is stored in the project. The version number, under the "Assembly...
14
2270
by: Phil | last post by:
I have been using this code to display the version number, and this has worked well, but I am now changing from using the ClickOnce publishing to a proper setup project, and this no longer works. If System.Diagnostics.Debugger.IsAttached = False Then Version.Text = "Version : " & My.Application.Deployment.CurrentVersion.ToString() Else Version.Text = "Debug Mode" End If
5
5707
dlite922
by: dlite922 | last post by:
Hey guys, I've built applications and I've always wanted my own version and build number that's more like bigger applications. Requirements: 1. The version should be manual (besides obviously there is no way for the app itself to know if it got a new feature vs a fix, I'd like to be the one starting new versions or sub-versions) 2. Build number should be automatic based on the most recently modified file. My Idea:
0
9530
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10459
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10236
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10017
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7552
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6793
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5577
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3734
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2928
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.