Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AssemblyInfo version information asterisks

Tags:

c#

.net

It says in AssemblyInfo.cs for C# projects that it's possible to specify version information with *

// Version information for an assembly consists of the following four values: // //      Major Version //      Minor Version  //      Build Number //      Revision // // You can specify all the values or you can default the Revision and Build Numbers  // by using the '*' as shown below: [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] 

I changed it to this:

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

and this is the error I get from the compiler:

error CS0647: Error emitting 'System.Reflection.AssemblyVersionAttribute' attribute -- 'The version specified '1.0.*.*' is invalid' warning CS1607: Assembly generation -- The version '1.0.*.*' specified for the 'file version' is not in the normal 'major.minor.build.revision' format 

How does (does it even?) it work?

like image 343
mare Avatar asked Apr 19 '12 14:04

mare


1 Answers

Syntax (see MSDN) for "automatic" build number can be:

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

or:

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

* means after this everything is automatic. You can't have automatic build number and fixed revision number then this syntax isn't correct:

[assembly: AssemblyVersion("1.0.*.0")] 

For the AssemblyFileVersionAttribute you cannot use the * special character so you have to provide a full and valid version number. Please note that if you do not provide an AssemblyFileVersionAttribute then you'll get the right FileVersionInfo automatically (with the same version of AssemblyVersionAttribute). You need to specify that attribute only if you need to set a different version.

like image 191
Adriano Repetti Avatar answered Sep 21 '22 13:09

Adriano Repetti