Bagikan melalui


My.Application.Info.Version Property

Gets the version number of the application.

' Usage
Dim value As System.Version = My.Application.Info.Version
' Declaration
Public ReadOnly Property Version As System.Version

Property Value

A Version object containing the version number of the application.

Exceptions

The following condition can cause an exception:

  • The application does not have sufficient permissions to access the assembly version (SecurityException).

Remarks

The My.Application.Info.Version property gets a Version object containing the version number of the application. You can use the Major, Minor, Build, and Revision properties of the Version object to access specific version information about the application.

ClickOnce-deployed applications should use the CurrentVersion property of the My.Application.Deployment Property.

Example

This example uses the My.Application.Info.Version property to display the version of the application.

MsgBox("Application version: " & My.Application.Info.Version.ToString)

Requirements

Namespace:Microsoft.VisualBasic.ApplicationServices

Class:AssemblyInfo

Assembly: Visual Basic Runtime Library (in Microsoft.VisualBasic.dll)

Availability by Project Type

Project type

Available

Windows Application

Yes

Class Library

Yes

Console Application

Yes

Windows Control Library

Yes

Web Control Library

No

Windows Service

Yes

Web Site

No

Permissions

The following permission may be necessary:

Permission

Description

FileIOPermission

Controls the ability to access files and folders. Associated enumeration: Unrestricted.

For more information, see Code Access Security and Requesting Permissions.

See Also

Reference

My.Application.Info Object

My.Application.Deployment Property

CurrentVersion

System.Version

AssemblyInfo.Version