7

In WinForms I have an AssemblVersion

[assembly: AssemblyVersion("01.01.01.002")]

However when the splash screen comes up it completely ignores the zeros showing:

1.1.1.2 

as the version which is very inconvenient since later I will actually want to have an assembly version

 [assembly: AssemblyVersion("01.01.01.200")]

Is there a way to avoid this or do I Have to add some number at the beginning of last part of the version like so:

[assembly: AssemblyVersion("01.01.01.102")]
Nickolay Kondratyev
  • 4,959
  • 4
  • 25
  • 43
  • 1
    The parts of the assembly version are converted to integers at some point (and then presumably back to a string): it's not possible to have leading zeros in the AssemblyVersion. *But*, it should be possible to add a different attribute with your exact string .. –  Mar 29 '13 at 00:38

1 Answers1

12

The AssemblyVersion attribute stores it's information as a Version object. The components of the Version struct are integers, and are treated as such. So 1.2.3.4 == 1.02.003.004 but 1.2.3.4 != 1.2.3.400

You can use the AssemblyInformationalVersionAttribute to provide aditional, arbitrarily formatted information about your product, as it's information is stored as a string, rather than a Version. So you can do:

[assembly: AssemblyVersion("1.1.1.102")]
[assembly: AssemblyInformationalVersion("v.01 alpha")]

Or whatever you like

p.s.w.g
  • 146,324
  • 30
  • 291
  • 331
  • doc: https://learn.microsoft.com/en-us/dotnet/api/system.reflection.assemblyversionattribute?source=recommendations&view=net-7.0 – user1108069 Apr 10 '23 at 08:02