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.

DavidRR
  • 18,291
  • 25
  • 109
  • 191
Sheridan
  • 68,826
  • 24
  • 143
  • 183
  • 1
    possible duplicate of [AssemblyInfo version information asterisks](http://stackoverflow.com/questions/10229711/assemblyinfo-version-information-asterisks) – Peter Ritchie Mar 19 '13 at 17:14

1 Answers1

66

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.

Community
  • 1
  • 1
Cody Gray - on strike
  • 239,200
  • 50
  • 490
  • 574
  • 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. – Sheridan Mar 19 '13 at 17:22
  • An update on this, AssemblyFileVersion accepts the `*` character in .NET 4 onward. – Razor May 08 '13 at 12:38
  • 2
    @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. – Cody Gray - on strike May 08 '13 at 19:06
  • @CodyGray My apologies you're correct. I'm too busy in VS land ignoring what's under the covers :) – Razor May 09 '13 at 23:02
  • https://msdn.microsoft.com/en-us/library/system.reflection.assemblyfileversionattribute.assemblyfileversionattribute(v=vs.100).aspx "wild cards are NOT supported" – Roger Willcocks Aug 16 '15 at 22:31