Fix the Automatically Incremented Revision Number
Not Showing in the About Box of VB.NET Application
If you’re developing a VB.NET application and have set your project to automatically increment the revision number with each publish, you might encounter a common issue: the version number in the About Box isn’t updating as expected. Instead of displaying the latest revision, it continues to show an older version number sourced from My.Application.Info.Version
. In this blog post, we will explore the issue and present a simple solution that allows you to display the correct, auto-incremented version in your application’s About Box.
Understanding the Issue
When you configure your VB.NET application for publishing, you can easily set it to automatically increment the revision number. This feature is incredibly helpful for maintaining version control and keeps end-users aware of the updates. However, the problem arises when:
- The About Box, which usually provides application metadata, does not reflect this updated version.
- Instead, it displays the assembly version instead of the newer publish version that includes the incremented revision.
Understanding where the version numbers are pulled from is crucial to addressing this issue effectively.
Why Does This Happen?
The main reason for this inconsistency lies in how the application retrieves version information:
- About Box: By default, it uses
My.Application.Info.Version
. - Published Versions: The auto-increment feature updates the version number in the published files, not necessarily in the About Box.
This is precisely why your About Box seems to be stuck with outdated information while the current published version reflects what you expect.
Solution: Updating the About Box Version
To display your automatically incremented revision number in the About Box, you need to modify the code that assigns the version text. Follow these steps to implement the solution:
Step 1: Locate the About Box Code
Open your project in Visual Studio and find the section of code that populates the About Box. This is usually in a form that’s responsible for displaying your application’s information.
Step 2: Modify the Version Display Code
Instead of using the default version pull from My.Application.Info.Version
, change your code to use the CurrentVersion
property from the Deployment object:
Me.LabelVersion.Text = String.Format("Version {0}", My.Application.Deployment.CurrentVersion.ToString)
This line of code will fetch the currently published version, which includes your automatically incremented revision, and display it correctly in the About Box.
Step 3: Test Your Application
Once you’ve made this change, republish your application. Open the About Box to confirm that it now shows the updated revision number as expected. If everything has been set correctly, you should see the current version alongside the other application details.
Conclusion
In conclusion, ensuring that your VB.NET application’s About Box displays the correct, automatically incremented revision number is straightforward. By using the My.Application.Deployment.CurrentVersion
property instead of the default assembly version, you can keep your users informed of the latest updates.
If you follow the steps outlined in this post, you should have no trouble getting the About Box version to reflect the current state of your application, which is essential for good version control and user communication.
Feel free to reach out with questions or additional tips on managing versioning in your VB.NET applications!