Hi

I'm trying to display the version number of my application on the screen using the code below.

Version = My.Application.Info.Version.ToString

When ever this line of code runs Version always ends up being 1.0.0.0 but my publish version number is 1.0.0.33

Is the My.Application.Info.Version not the same as the publish version number?

Can some one tell me what I'm doing wrong

Thanks

Simon

Did you set the version number by going to Project/Properties/Assembly Information and typing it into the dialog? That's where My.Application.Info.Version gets it from.

Did you set the version number by going to Project/Properties/Assembly Information and typing it into the dialog? That's where My.Application.Info.Version gets it from.

Ah ok, I was hoping that each time I published my code after making changes the version number would auto increment without me having to do anything. Looks like

My.Application.Info.Version

is not going to do what I want it to do:(

There is a quick way to do this, set your (Solution)/(Project)/My Project/app.manifest to always copy to the output dir. then in your code use a simple XML reader to grab the version out of that file:

Try
            Dim m_xmld = New XmlDocument()
            m_xmld.Load(Application.ExecutablePath & ".manifest")
            Label14.Text = "v" & m_xmld.ChildNodes.Item(1).ChildNodes.Item(0).Attributes.GetNamedItem("version").Value
        Catch ex As Exception
        Finally
        End Try

does someone knows how to get the whole assembly information using a similar code like the one posted in this Thread??

thanks...

as far as i know that is all you can get...

I have found a way to set the My.Application.Info.Version successfully in VB.NET using Microsoft Visual Basic 2010 Expres.

Navigate to your Projects Properties. (I do this by going to View > [projectname] Properties...) Then make sure you have the "Application" tab selected. Click on the button "Assembly Information". In here you can set the "Assembly version:" fields and they can then be referenced in your application by calling My.Application.Info.Version. This number will not auto-increment, you will have to change it manually.

The numbers seen in [projectname] Properties > Publish tab > Publish Version are always ingored ignored.

Hi,
I use this code when I publish applications.

Imports System.Deployment.Application

If (ApplicationDeployment.IsNetworkDeployed) Then
Dim AD As ApplicationDeployment = ApplicationDeployment.CurrentDeployment
Label2.Text = "v " & AD.CurrentVersion.ToString
Else
Label2.Text = "v " & My.Application.Info.Version.ToString
End If

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.