Version Numbering for Visual Basic 6.0 Users
The version numbering scheme for Visual Basic 2008 differs from that used in Visual Basic 6.0, and the methods for setting and retrieving version numbers differ as well.
Conceptual Differences
In Visual Basic 6.0, setting the Major, Minor, and Revision properties of the App object control the version number for an application. For example, setting Major to 1, Minor to 2, and Revision to 3 results in a version number of 1.2.0.3. The third part of the version number (0) cannot be seen in Visual Basic; however it is visible when you look at the properties of a file compiled by Visual Basic 6.0.
In Visual Basic 2008, the version-number properties are replaced by an AssemblyVersion attribute, which has four parts: Major, Minor, Build, and Revision. For the above example, the resulting version number would be 1.2.x.4, where x is the build number. Note that the Revision value is now the fourth part of the version number.
Setting Version Properties
In Visual Basic 6.0, version-number properties are set in the Project Properties dialog box; in Visual Basic 2008 they are set in the Assembly Information dialog box, available by clicking the Assembly Information button on the Application tab of the Project Designer.
Note
Visual Basic 6.0 version-number properties are stored in the Project (.vbp) file and can also be edited directly using a text editor such as Notepad. Assembly attributes are stored in the AssemblyInfo.vb file and can also be edited directly in the Code Editor.
Code Changes for Version Numbering
The following code example illustrates the differences in coding techniques between Visual Basic 6.0 and Visual Basic 2008.
Code Changes for Displaying an Application's Version Number
The following example demonstrates retrieving an application's version number and displaying it in a label.
' Visual Basic 6.0
Label1.Caption = "Version: " & App.Major & "." & App.Minor & "." _
& App.Revision
'Visual Basic
Label1.Text = My.Application.Info.Version.ToString()
Version Number Property Equivalencies
The following table lists Visual Basic 6.0 version-number properties and their Visual Basic 2008 equivalents.
Visual Basic 6.0 |
Visual Basic 2008 |
---|---|
No equivalent |
My.Application.AppInfo.Version.Build |
Major |
My.Application.AppInfo.Version.Major |
Minor |
My.Application.AppInfo.Version.Minor |
Revision |
My.Application.AppInfo.Version.Revision
Note:
In Visual Basic 6.0, Revision is the fourth part of the version number; in Visual Basic 2008, it is the third part.
|
Upgrade Notes
When an application is upgraded from Visual Basic 6.0, only the Major and Minor properties are upgraded; Visual Basic 2008 assigns new values for the Revision and Build properties.