Recipe 2.6. Letting Visual Studio Automatically Update an Application's Version NumberProblemYou 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. SolutionLet 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.*")> DiscussionVisual 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. |