5

Possible Duplicate:
Details of Assembly version

How does the Assembly Version get generated in VS/.NET? I know that there is a couple of strings in AssemblyInfo.cs or AssemblyInfo.vb with something like this:

' Version information for an assembly consists of the following four values:
'
'      Major Version
'      Minor Version 
'      Build Number
'      Revision
'
' You can specify all the values or you can default the Build and Revision Numbers 
' by using the '*' as shown below:
' <Assembly: AssemblyVersion("1.0.*")> 

<Assembly: AssemblyVersion("1.0.0.0")> 
<Assembly: AssemblyFileVersion("1.0.0.0")> 

But how does the final assembly version get created? How does it get incremented? Where does the last value get stored? We have a custom in-house release environment and I would like to customize the assembly version... I looked around on google but couldn't find anything... Any pointers?

Community
  • 1
  • 1
Denis
  • 11,796
  • 16
  • 88
  • 150

4 Answers4

5

Using the "1.0.*" setting for the Assembly version will do the following:

  • Major Version: 1 (as you indicated)
  • Minor Version: 0 (as you indicated)
  • Build Number: Number of days since 1/1/2000.
  • Revision: Number of Milliseconds since 12:00AM (UTC?)

So that's how the incrementing works...

Matt
  • 1,043
  • 5
  • 8
3

The major and minor versions are not incrimented, they are fixed by what is specified. The build number is the number of days since January 1st, 2000. The revision number is the number of seconds since midnight (local time) divided by two.

You can see more detail on MSDN

...build to be equal to the number of days since January 1, 2000, local time, and revision to be equal to the number of seconds since midnight of the current day, local time, divided by 2.

Alexei Levenkov
  • 98,904
  • 14
  • 127
  • 179
Bob
  • 97,670
  • 29
  • 122
  • 130
1

Look into AssemblyInfo Task if you don't like the built in behaviour!

http://archive.msdn.microsoft.com/AssemblyInfoTaskvers

banging
  • 2,540
  • 1
  • 22
  • 26
0

Just generate file that contains version the way you need, at least for official builds. Having version different between assemblies coming from the same "build" is confusing.

You also may want more control over version to know if build is from someone's machine or some sort of official build.

One more consideration: if you have public API of any kind and need to provide backward/forward compatibility auto-generation of version will make it almost impossible.

Alexei Levenkov
  • 98,904
  • 14
  • 127
  • 179