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

1

31

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.

Densitometer answered 19/3, 2013 at 16:59 Comment(1)
possible duplicate of AssemblyInfo version information asterisksCatechumen
K
67

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.

Kletter answered 19/3, 2013 at 17:13 Comment(5)
Thanks, you are quite right... somehow I totally missed that line in the other post, I then came back here to delete this post, but you had already answered it, so I can't. I've voted to close it instead.Densitometer
An update on this, AssemblyFileVersion accepts the * character in .NET 4 onward.Causeuse
@Vince It didn't work in Visual Studio 2010, whether targeting .NET 4 or any other version. Do you mean that it works with VS 2012? This is related to the version of the compiler/linker, not the target framework.Kletter
@CodyGray My apologies you're correct. I'm too busy in VS land ignoring what's under the covers :)Causeuse
msdn.microsoft.com/en-us/library/… "wild cards are NOT supported"Phonsa

© 2022 - 2024 — McMap. All rights reserved.