1

Windows 10 x64. Visual Studio 2019 v16.6.1. Rider 2020.1.3.

Microsoft official documentation:

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.

I edited version info in my AssemblyInfo.cs file:

// 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.*")]
[assembly: AssemblyFileVersion("1.0.*")]

But if I rebuild my project by Rider IDE and check assembly version I see unexpected result:

enter image description here

If I try to do the same in Visual Studio 2019 v16.6.1 then I get compilation error even:

enter image description here

If I set Deterministic to false according this advice then compilation error doesn't happen but I get the same result:

enter image description here

Why does it happen? How can I fix it?

Andrey Bushman
  • 11,712
  • 17
  • 87
  • 182
  • 1
    If that's the way to say "you shouldn't use it any more", I won't be surprised. – Lex Li Jun 12 '20 at 13:28
  • @LexLi but why they writes info about '*' in the comments of AssemblyInfo.cs still? – Andrey Bushman Jun 12 '20 at 13:31
  • Keep in mind documentation can easily go out-of-date. The comments have been there since .NET Framework 1.0 and probably no one really cares about whether they work or not today. BTW, SDK style projects no longer have that part, so the future is clear. – Lex Li Jun 12 '20 at 13:33
  • 1
    Apparently you need to [remove the `AssemblyFileVersion`](https://stackoverflow.com/a/356694/11683) for asterisks in `AssemblyVersion` to work. `AssemblyFileVersion` doesn't support asterisks anyway. – GSerg Jun 12 '20 at 13:33
  • @GSerg you are right! Thank you! – Andrey Bushman Jun 12 '20 at 13:36

0 Answers0