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?