Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Application.ProductVersion always returns 1.0.0.0

Tags:

vb.net

On the publish tab of My Project the correct current version is there, 1.1.0.0 and in Programs and Features under Control Panel it shows 1.1.0.0 but when I reference Application.ProductVersion I get 1.0.0.0.

What am I doing wrong or what am I missing here?

Thanks.

like image 295
Tom Avatar asked Oct 25 '10 12:10

Tom


1 Answers

The assemby version (in the application.config file) and the ClickOnce Publish version are 2 seperate numbers.

If you want to get the ClickOnce version at runtime you can use the following code

     If (System.Deployment.Application.ApplicationDeployment.IsNetworkDeployed) Then
        With System.Deployment.Application.ApplicationDeployment.CurrentDeployment.CurrentVersion
            Me.Text = "V" & .Major & "." & .Minor & "." & .Build
        End With
     End If

Edit: For the full, four-segment revision number you'll need:

Me.Text = "V" & .Major & "." & .Minor & "." & .Build & "." & .Revision 
like image 82
DJIDave Avatar answered Oct 23 '22 17:10

DJIDave