简体   繁体   中英

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?

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

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.

尝试注释掉[assembly:AssemblyFileVersion(“1.0.0.0”)]并只留下[assembly:AssemblyVersion(“1.0。*”)]

Is is the File Version that is not changing?

The third number (out of 4) is the number of days since 2000. This will not change with each build, only with each passing day.

Change it to be:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM