Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change Build Numbering format in Visual Studio

I've inherited a .NET application that automatically updates it's version number with each release. The problem, as I see it, is the length and number of digits in the version number.

An example of the current version number format is 3.5.3167.26981 which is a mouthful for the users to say when they are reporting bugs.

What I would like is something more like this: 3.5 (build 3198). I would prefer to manually update the major and minor versions, but have the build number update automatically.

Even better, I don't want the build number to increment unless I am compiling in RELEASE mode.

Anyone know if there is a way to do this -- and how?

like image 781
Mike C. Avatar asked Sep 02 '08 22:09

Mike C.


1 Answers

In one of the project files, probably AssemblyInfo.cs, the assembly version attribute is set to [assembly: AssemblyVersion("3.5.*")] or something similar. The * basically means it lets Visual Studio automatically set the build and revision number.

You can change this to a hard coded value in the format <major version>.<minor version>.<build number>.<revision>

You are allowed to use any or all of the precision. For instance 3.5 or 3.5.3167 or 3.5.3167.10000.

You can also use compiler conditions to change the versioning based on whether you're doing a debug build or release build.

like image 86
Joseph Daigle Avatar answered Oct 08 '22 11:10

Joseph Daigle