Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does an Assembly Version get generated in .NET? [duplicate]

Tags:

c#

.net

vb.net

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?

like image 971
Denis Avatar asked Apr 30 '12 16:04

Denis


People also ask

What is the difference between assembly version and file version?

AssemblyVersion: Specifies the version of the assembly being attributed. AssemblyFileVersion: Instructs a compiler to use a specific version number for the Win32 file version resource.

What is assembly versioning in VB net?

Whenever a new . NET assembly is created in the . Net environment, a file named AssemblyInfo is created that contains attributes used to define the version of the assembly during compilation. All versioning of assemblies that use the common language runtime is done at the assembly level.

Where is assembly version C#?

"Assembly File Version" is what shows when you right-click on a file and go to "properties" then the "details" tab.


3 Answers

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...

like image 53
Matt Avatar answered Oct 19 '22 06:10

Matt


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.

like image 3
Bob Avatar answered Oct 19 '22 06:10

Bob


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

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

like image 1
banging Avatar answered Oct 19 '22 06:10

banging