简体   繁体   English

AssemblyInfo内部版本号未更新

[英]AssemblyInfo build number not updated

I have the following code in AssemblyInfo.cs : 我在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. 我正在尝试确保每次构建/重建项目时Build Number更改。 But, in that case it doesn't. 但是,在那种情况下它没有。 Only the Revision changes if I build it on different days. 如果我在不同的日子构建它,则只有Revision更改。

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.. 如果您需要更改AssemblyFileVersion,则必须手动执行此操作。

Or, you can use T4 templating mechanism, as described HERE 或者,你可以使用T4模板机制,如所描述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: MSDN说:

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. 例如,[assembly:AssemblyVersion(“2.3.25.1”)]表示2为主要版本,3表示次要版本,25表示构建号,1表示版本号。 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. 诸如[assembly:AssemblyVersion(“1.2。 ”)]之类的版本号指定1作为主要版本,2作为次要版本,并接受默认的构建和修订号。 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. 诸如[assembly:AssemblyVersion(“1.2.15。*”)]之类的版本号指定1作为主要版本,2作为次要版本,15作为构建号,并接受默认修订号。 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. 默认修订号是自当地时间午夜起的秒数(不考虑夏令时的时区调整)除以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. 第三个数字(满分4个)是自2000年以来的天数。这不会随着每次构建而改变,只是每天都有。

Change it to be: 将其更改为:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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