Recipe 2.6. Letting Visual Studio Automatically Update an Application s Version Number


Recipe 2.6. Letting Visual Studio Automatically Update an Application's Version Number

Problem

You want to ensure that the version number changes at least a little each time you build the application, but repeatedly updating the version number by hand is a hassle.

Solution

Let Visual Basic update the build and revision components of the version number for you. Instead of supplying digits for these components, use an asterisk for the build component:

 <Assembly: AssemblyVersion("1.2.*")> 

If you want to control the build number but have Visual Basic generate the revision number, include the digits for the build component and use an asterisk for the revision component:

 <Assembly: AssemblyVersion("1.2.3.*")> 

Discussion

Visual Basic will auto-generate build and revision numbers for you if you supply an asterisk in place of actual digits. When auto-generating the build number, Visual Basic uses the number of days since January 1, 2000. When auto-generating the revision number, Visual Basic uses the number of seconds elapsed since midnight of the current day, divided by two. This value starts over at zero each midnight.

Although Visual Basic will update the build and revision numbers for you, you must supply the major and minor version numbers.




Visual Basic 2005 Cookbook(c) Solutions for VB 2005 Programmers
Visual Basic 2005 Cookbook: Solutions for VB 2005 Programmers (Cookbooks (OReilly))
ISBN: 0596101775
EAN: 2147483647
Year: 2006
Pages: 400

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net