Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AssemblyInfo build number not updated

I have the following code in AssemblyInfo.cs:

[assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyFileVersion("1.0.0.0")]

I'm trying to make sure the Build Number changes each time I build/rebuild my project. But, in that case it doesn't. Only the Revision changes if I build it on different days.

What am I missing?

like image 949
Idanis Avatar asked Nov 03 '15 12:11

Idanis


People also ask

What is AssemblyInfo CS file?

AssemblyInfo. cs contains information about your assembly, like name, description, version, etc. You can find more details about its content reading the comments that are included in it.

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.


2 Answers

Just comment this:

[assembly: AssemblyVersion("1.0.*")]    
//[assembly: AssemblyFileVersion("1.0.0.0")] 

If you need to change AssemblyFileVersion, you will have to do it manually..

Or, you can use T4 templating mechanism, as described HERE

like image 164
Amel Avatar answered Sep 28 '22 06:09

Amel


You need to comment out the

// 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: AssemblyFileVersion("1.0.0.0")]

The MSDN says:

You can specify all the values or you can accept the default build number, revision number, or both by using an asterisk (). For example, [assembly:AssemblyVersion("2.3.25.1")] indicates 2 as the major version, 3 as the minor version, 25 as the build number, and 1 as the revision number. A version number such as [assembly:AssemblyVersion("1.2.")] specifies 1 as the major version, 2 as the minor version, and accepts the default build and revision numbers. A version number such as [assembly:AssemblyVersion("1.2.15.*")] specifies 1 as the major version, 2 as the minor version, 15 as the build number, and accepts the default revision number. The default build number increments daily. The default revision number is the number of seconds since midnight local time (without taking into account time zone adjustments for daylight saving time), divided by 2.

like image 32
Rahul Tripathi Avatar answered Sep 28 '22 05:09

Rahul Tripathi