VB 2005 Click Once Program Version

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I want to display the program version shown on the "Publish Version" of the
"Publich" tab on the project properties screen.
My.Application.Info.Version.ToString only ever shows 1.0.0.0.
My.Application.Deployment.CurrentVersion.ToString raises an error in the IDE.

How can I get the 1.0.0.52 that Click Once uses?
 
Hi John,

To get the current version of a ClickOnce application, we use the
My.Application.Deployment.CurrentVersion property (VB.NET) or
System.Deployment.Application.ApplicationDeployment.CurrentDeployment.Curren
tVersion property (C#).

But we could use this property only after the application is deployed via
ClickOnce. If we run the application when it is not installed, we will get
an exception of 'Application identity is not set'. If we run it with VS
debugger, i.e. press F5 to run it, we get an exception stating that
'Application is not installed'.

I suggest that you add a condition before you use the
My.Application.Deployment.CurrentVersion property, that is 'If
(My.Application.IsNetworkDeployed) Then'.

Hope this helps.
If you have any question, please feel free to let me know.

Sincerely,
Linda Liu
Microsoft Online Community Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
 
Thanks Linda, that works! But it would be useful if in the IDE
My.Application.Deployment.CurrentVersion could return the version number
shown under 'Publish Version' on the 'Publish' page of the project settings.

Thanks again,
 
Back
Top