Search code examples
c#.netversioning.net-assemblyassemblyinfo

What is the required format for assembly versions?


The Version class in .NET represents version numbers as consisting of two to four components. AssemblyInfo files specify the following format for the AssemblyVersion and AssemblyFileVersion fileds:

// Version information for an assembly consists of the following four values:
//
//      Major Version
//      Minor Version 
//      Build Number
//      Revision

It is unclear if Build Number and Revision are required here, since they aren't required in the Version class. Are they required? In other words, is this legal?

[assembly: AssemblyVersion("1.0")]
[assembly: AssemblyFileVersion("1.0")]

Or does that need to be represented as the following?

[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

Solution

  • It appears that the AssemblyVersion may be in a variety of forms:

    Examples of valid version strings include:
    1
    1.1
    1.1.*
    1.1.1
    1.1.1.*
    1.1.1.1
    

    But AssemblyFileVersion must be of the form major.minor.build.revision:

    The file version is normally a string of four numbers, separated by periods, reflecting the major version number, minor version number, build number, and revision number; for example, "1.0.4309.00". If version is not in this format, a compiler warning occurs, and the results displayed in the file properties dialog are unpredictable. Wildcards are not supported.