Trying to get the version numbers

itms

Active member
Joined
Feb 21, 2018
Messages
33
Programming Experience
10+
Hi,

When I look in the control panel or in Properties for my Publish version I see 0.3.0.171 (for major, minor, build, and Revision).
However, I want to display this on a form, and I have gotten tons of different codes online and if they work at all give me, v0.2.0.1.
And it never changes that I can see.
I do not know what this is but I need whatever the version os that gives me 0.3.0.171.
Also, we use Oneclick for deployment, if that matters.

Can someone show me how to do this/

Thank you
 
Did you try this?
VB.NET:
If  My.Application.IsNetworkDeployed Then
    Label1.Text = My.Application.Deployment.CurrentVersion.ToString()
End If
 
Hi, and thanks for the reply, but I have tried this and it does not work.
If I have the if statement in there it just bypasses it.
If I take them out I get the following:
System.Deployment.Application.InvalidDeploymentException.

Please tell me what I can do.
Thank you
 
Not sure, but I think that means the application has not been deployed. It will not work for debugging, you have run the installed app.
 
I use -
Function Version() As String
With System.Diagnostics.FileVersionInfo.GetVersionInfo(System.Reflection.Assembly.GetExecutingAssembly.Location)
Return .FileMajorPart & "." & .FileMinorPart & "." & .FileBuildPart & "." & .FilePrivatePart
End With

End Function
 
That is not the publish version that OP asked for, that is the file version.
Also, Application.ProductVersion is much easier to use when you want file version, and call .ToString on that to get the string.
 
Back
Top