Winforms: getting publication version number?

I have a Winforms application and you want to display the version number so that we can know if our update scripts are running correctly. Is there a way to get the version number of the publication (as shown on the application properties pages, the Publish tab)?

When I use Reflection.Assembly.GetExecutingAssembly (). GetName (). The version etc. seems to use the AssemblyVersion number from AssemblyInfo.vb, which is not the same.

If I use wildcards in AssemblyInfo.vb, it displays different numbers again.

+6
source share
3 answers

This will give you the published version:

ApplicationDeployment.CurrentDeployment.CurrentVersion 
+10
source

Try the following:

If My.Application.IsNetworkDeployed Then
Label1.Text = My.Application.Deployment.CurrentVersion.ToString ()
End if

The publication version will appear at run time.

I didn’t notice that “publish version will appear at runtime”, but I was able to use it and set my shortcut to say “N / A during debugging” and then publish it and displays the published version.

+1
source

Try the following:

 If My.Application.IsNetworkDeployed Then Label1.Text = My.Application.Deployment.CurrentVersion.ToString() End If 

The publication version will appear at run time.

-1
source

Source: https://habr.com/ru/post/944456/


All Articles