.netwarningswildcardassemblyversionattribute

CS1607: The version specified for the 'file version' is not in the normal 'major.minor.build.revision' format in .NET


I am trying to set my AssemblyVersion and AssemblyFileVersion attributes in my project like so:

[assembly: AssemblyVersion("3.0.*")]
[assembly: AssemblyFileVersion("3.0.*")]

but I get this warning:

CS1607: Assembly generation -- The version '3.0.*' specified for the 'file version' is not in the normal 'major.minor.build.revision' format

On the AssemblyVersionAttribute Class page at MSDN is the following:

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.

Note the bold section. Does anyone know why [assembly: AssemblyVersion("3.0.*")] (from my project) is not valid, but [assembly:AssemblyVersion("1.2.*")] (from the MSDN example) is valid?

In particular, I am curious to know if I can start with a non-zero major number, as the application that I am writing is version 3 of the program.

UPDATE >>> Sorry, this does seem to be answered in the other post... please vote to close it, thanks.


Solution

  • You're assuming that the problem is with this line:

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

    when it is actually with this one:

    [assembly: AssemblyFileVersion("3.0.*")]
    

    Like the accepted answer to the question that you say is not a duplicate of this one says:

    For the AssemblyFileVersionAttribute you cannot use the * special character so you have to provide a full and valid version number.

    That * syntax works only with the AssemblyVersion attribute. It doesn't work with the AssemblyFileVersion attribute.

    There are two workarounds to achieve the results you probably desire here:

    1. Simply omit the AssemblyFileVersion attribute altogether. That will cause the assembly file version information to be automatically divined from the AssemblyVersion attribute (which is the one that does support the * syntax).

    2. Break out the big guns and install the Build Version Increment add-in, which offers you more version incrementing options than you can shake a stick at.