Version Control Tool






3.22/5 (5 votes)
Jun 2, 2005
4 min read

58346

842
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.
Introduction
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.
History
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.
[assembly: AssemblyVersion("1.0.*")]
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 |
---|---|
Advantages | |
|
|
Disadvantages | |
|
|
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.
Tool Overview
Main Screen
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.
VersionControl.exe.config
<?xml version="1.0" encoding="utf-8"?> <configuration> <configSections> <section name="CommonConfiguration" type="System.Configuration.NameValueSectionHandler, system, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> </configSections> <CommonConfiguration> <Revision Value="7"/> <MajorMinorBuild Value="3.2.6"/> </CommonConfiguration> </configuration>
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.
- Reads the
- 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).
- Searches
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.
Screen shows
- 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.