Skip to content

ldiegos/GMS.Utils.AssemblyInfo

Repository files navigation

Introduction

How To Update Assembly Version Number Automatically

http://www.codeproject.com/Articles/31236/How-To-Update-Assembly-Version-Number-Automaticall

The Problem

I suppose I am not the only one who does not like the version numbers automatically generated by Visual Studio when you specify something like the following in your AssemblyInfo.cs file:

[assembly: AssemblyVersion("2.7..")]

In the other hand, I would like to specify those numbers automatically during the build process. Moreover it would be great to have an ability to change the whole version number or just increase the latest part of it (build number).

Of course, you may say that such an operation can simply be done manually. It is true for one or two assemblies. But our usual project contains about 10-15 different assemblies and we would like to have a version number in all of them synchronized.

The Solution:

So we need some utility which will perform all the described tasks automatically and which we can call from our build script. The presented simple program allows to change the whole version number in AssemblyInfo files or just increase the number of the build.

To use this program, just call AssemblyInfoUtil.exe with two parameters. The first parameter is the path to AssemblyInfo.cs file that you would like to modify. The second parameter tells the program how to modify the version number attribute. It can be one of the following options:

-set:<New Version Number>

Set the version number to the specified one.

-inc:<Parameter Index>

Simply increase the number of one parameter in version string by 1. Here "Parameter Index" can be any number from 0 to 4. For 0 - Increase all values sequentially; 1 - the major version number will be increased, for 2 - the minor one and so on. Examples

AssemblyInfoUtil.exe -set:3.1.7.53 "C:\Program Files\MyProject1\AssemblyInfo.cs"

Set the version string to "3.1.7.53".

AssemblyInfoUtil.exe -inc:4 AssemblyInfo.cs Increase the Revision number(x.x.x.53). So in our case it will become 54 until 65534 and then 0 again.

AssemblyInfoUtil.exe -inc:3 AssemblyInfo.cs Increase the Build Number(x.x.7.x). So in our case it will become 8 until 65534 and then 0 again.

AssemblyInfoUtil.exe -inc:2 AssemblyInfo.cs Increase the Minor Version(x.1.x.x). So in our case it will become 2 until 65534 and then 0 again.

AssemblyInfoUtil.exe -inc:1 AssemblyInfo.cs Increase the Major Version(3.x.x.x). So in our case it will become 4 until 65534 and then 0 again.

AssemblyInfoUtil.exe -inc:0 AssemblyInfo.cs Increase all numbers secuentially(3.1.7.53). So when Revision number reach 65534, will be reset to 0 and increase Build number, then when Build Number reach 65534, then reset and increase Minor version and so on.

LUIS DE DIEGO

Getting Started

TODO: Guide users through getting your code up and running on their own system. In this section you can talk about:

  1. Installation process
  2. Software dependencies
  3. Latest releases
  4. API references

Build and Test

TODO: Describe and show how to build your code and run the tests.

Contribute

TODO: Explain how other users and developers can contribute to make your code better.

If you want to learn more about creating good readme files then refer the following guidelines. You can also seek inspiration from the below readme files:

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published