使用星号时,是什么原因导致大会版本增量?星号、增量、大会、版本

2023-09-03 16:41:05 作者:罐装

如果我有一个程序集的版本,例如:

If I have an assembly version such as:

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

在这个版本号被读取时,它会像 2013.7.18.123

When this version number is read, it will be something like 2013.7.18.123.

是什么原因导致的最终数目的增量?

What causes the incrementation of the final number?

推荐答案

这是不可以递增,这需要构建系统知道previous版本。它没有这样的知识。你基本上得到一个随机数。这并不是说随机,版本号,从一天中的时间产生的。版本号也可以被随机化,它是由日期产生的。

It is not incremented, that would require the build system to know the previous version. It has no such knowledge. You are essentially getting a random number. It isn't that random, the revision number is generated from the time of day. The build number can also be randomized, it is generated from the date.

请注意使用 2013年7月18日的结果。* ,你有没有保证,这将是独一无二的。如果你曾经建立在精确的同一时间,那么你会得到完全一样的号码。它也不会自动成为的大的版本号,更早建立你就会倒退。这是的没有的版本号巨大的属性。

Do note the consequence of using 2013.7.18.*, you have no guarantee that it will be unique. If you ever build on the exact same time then you'll get the exact same number. It also won't automatically be a larger version number, build earlier and you'll go backwards. These are not great properties of a version number.

或者换句话说,只有使用 1.0。* 真的是有道理的,其产生的总增加一个版本号。由于该版本号将永远是较大的。

Or in other words, only using 1.0.* really makes sense, that generates a version number that always increases. Since the build number will always be larger.

这也是值得注意的是,你尽量把日期中的版本号。你已经得到了,如果你让它挑选的内部版本号,你总是可以反向工程从结果生成日期。内部版本号是自2000年1月1日的天数,版本号为秒,因为午夜(没有DST校正)的数量,除以二。

It is also notable that you do try to put the date in the version number. You already get that if you let it pick the build number, you can always reverse-engineer the build date from the result. The build number is the number of days since Jan 1st, 2000, the revision number is the number of seconds since midnight (no DST correction), divided by two.