Building a Visual Basic ClickOnce application. I want to display the Publish version number. When I display My.Application.Info.Version.ToString, it always reports 1.0.0.0. The publish version is actually 1.0.0.30. How can I pull the correct Publish version? Thanks.
Asked
Active
Viewed 791 times
1 Answers
0
Found the answer here: Winforms: getting Publish Version number?
There's a bug in the answer, though. The correct code is:
Imports System.Deployment.Application
If ApplicationDeployment.IsNetworkDeployed Then
strTemp = ApplicationDeployment.CurrentDeployment.CurrentVersion.ToString
Else
strTemp = Application.ProductVersion.ToString
End If

RBLevin
- 51
- 6
-
It's not a bug, it's how it is intended to work, the published version will appear at runtime. – Trevor Nov 23 '20 at 02:16
-
Hi Codexer. Please note the addition of ".ToString" --the routine won't work without it (at least, that's the behavior I saw in my app). – RBLevin Nov 24 '20 at 15:42