Visual Basic 2005 in a Nutshell (In a Nutshell (OReilly))

Version Property

Location

My.Application.Info.Version

Syntax

Dim result As System.Version = My.Application.Info.Version

Description

The Version property returns the version and revision numbers of the application as recorded in the assembly. The values are returned through an instance of the System.Version class.

Public Members

The System.Version object returned by this property includes the following version-specific components, each of type Integer.

  • Major

  • Minor

  • Build

  • Revision

Version numbers are generally presented to the user in the format:

Major.Minor.Build.Revision

Build and Revision are optional, and when not defined, their properties will return -1. Major and Minor are required.

Usage at a Glance

  • This property is read-only.

  • Use the ToString member of the returned object to generate a version number in a user-friendly display format.

  • An exception occurs if the user does not have sufficient privileges to examine the version number of the assembly.

  • Do not use this property from ClickOnce-deployed applications. Instead, use the My.Application.Deployment.CurrentVersion property.

Example

The following example displays the version number of the application.

MsgBox("You are using version " & _ My.Application.Info.Version.ToString)

Related Framework Entries

  • Microsoft.VisualBasic.ApplicationServices.AssemblyInfo.Version Property

  • System.Deployment.Application.ApplicationDeployment.CurrentVersion Property

  • System.Diagnostics.FileVersionInfo.FileVersion Property

  • System.Diagnostics.FileVersionInfo.ProductVersion Property

See Also

Info Object (My.Application)

Категории