This tool is used to modify version information of .NET assemblies. This tool allows you to auto increment or to manually choose Assembly Version, and to increment version information of all assembly files under a selected folder.
Every time you rebuild your project, Visual studio tends to generate a new version of the assembly. It does this because of the following line in the AssemblyInfo file in the project. According to Jeffrey Richter, the auto increment feature of assembly version is a bug; the original intent was to increment the version of a file, not the assembly.
The assembly version number is part of an assembly’s identity and plays a key part in binding to the assembly and in version policy. The default version policy for the runtime is that applications run only with the versions they were built and tested with, unless overridden by explicit version policy in configuration files (the application configuration file, the publisher policy file, and the computer's administrator configuration file).
The version number has four parts and we can specify all the values or can accept the default build and revision number by using a wild character (*) to automatically generate the Build and Version number where Build Number is set to the number of days since a random, designed start date and Version Number is set to the number of seconds since midnight.
<Major Version>.<Minor Version>.<Build Number>.<Revision>
You can either use auto-increment version number or opt to manually control version number as part of the build process.
|Auto Increment||Manually Control or Static Version|
- Build and Revision numbers are handled automatically by VS.NET.
- You guarantee never to have different builds of an assembly with the same version number.
- You have complete control over the exact version number.
- Assembly build number can be synchronized with the system build number.
- Build and Revision numbers are not increased by 1 but are based on the time an assembly is built.
- A new version of an assembly is generated each time it is built regardless of whether any changes have been made to the assembly.
- Problematic when you need to support your system in the production environment as the internal assembly build number does not match your system build number.
- Version number must be manually updated by the build coordinator or by the build support.
- If the version is not incremented with every build, you may end up with multiple builds of the same assembly with the same strong name which is undesirable and can be problematic for assemblies that are installed in the GAC (Global Assembly Cache).
In the AssemblyInfo file for each project, you have the opportunity to set the version number of the assembly. However, in a production environment or to match specific requirements of the development team, you may want to have a unique assembly version for all the assemblies under one application or under one solution.
When the number of projects grows, they will most likely be split into multiple solutions with some of the projects contained in several solutions. So, if you have two applications App-1 and App-2, and both of them use common assemblies C, D and E, then it is nice to have a unique version for all the class library source code that is used to compile solutions App-1 and App-2.
The tool has a configuration file which has got two settings:
Revision: Current revision version which will get updated with the new version when a new version change occurs.
MajorMinorBuild: Current Major-Minor-Build version separated by dot (.) which will get updated with the new value when manual increment of version occurs.
system, Version=1.0.3300.0, Culture=neutral,
Steps to follow to use the tool:
- Choose a folder which has the AssemblyInfo files.
- Choose either automatic Increment (default) or Manual Increment.
- Automatic Increment: Revision version will be incremented by 1.
- Manual Increment: need to choose Major, Minor, Build and Revision version from the dropdown.
- Click on Change Version which increments/changes the version information of all the AssemblyInfo files under the selected folder and the result is shown in the datagrid.
How it works
- Reads the Revision Version from the Config file and the same is shown in the screen.
- If Automatic Increment:
- Reads the
MajorMinorBuild version from the Config file.
- Increments the
Revision version by 1.
- If Manual Increment:
- Reads Major, Minor, Build and Revision version from the dropdown.
- Concatenates MajorMinorBuild version and Revision version by dot(.).
- Reads all the AssemblyInfo files (both .cs and .vb).
AssemblyVersion attribute and replaces the old version with the new value in the AssemblyInfo files.
- Updates the
Version tag with the new value in the VersionControl.exe.config file.
- Updates the
MajorMinorBuild version tag with the new value in the VersionControl.exe.config file if Manual Increment is selected.
- Attaches the result to the datagrid.
- Config file version (from the configuration file).
- New Version of the Assembly Info files.
- Total number of AssemblyInfo files updated.
- Grid shows: File path and the old version of the configuration files.
Main Screen – With Version Incremented