2

I have this sample configuration in my assemblyinfo file.

// You can specify all the values or you can default the Build and Revision Numbers 
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("3.1.0.*")]
[assembly: AssemblyFileVersion("3.1.0.0")]

Once I rebuild, I get this:

Fileversion: 3.1.0.0 Product version: 3.1.0.0

What I would like is the product version to be static, this is already fine, but I would like the file version to automatically increment, is this possible?

Assembly version is good for technical analysis, but file version is an NTFS property visible by right clicking the file in windows explorer, so customers and consultants can get an idea of the version without using a 3rd party tool.

JL.
  • 78,954
  • 126
  • 311
  • 459
  • I am a bit confused by your statements above; 'AssemblyFileVersion' will be static above because you set it to 3.1.0.0 'AssemblyVersion' will automatically increment by a value of '1' each time you 'Build' the solution. If you were to look at the binary in the /bin and build it again, AssemblyVersion would be 3.1.0.1 and continue to increment through each build. What are you calling 'Product Version'? In a nutshell, you use the '*' symbol in the position you want to auto increment. – atconway Sep 08 '10 at 12:55
  • @atconway, you cannot use * characters in the AssemblyFileVersion property, if you specify 3.1.* - build, then right click the file in explorer (under details), notice the file version is 3.1.* not 3.1.1 as expected. – JL. Sep 08 '10 at 12:56
  • See ... http://stackoverflow.com/questions/64602/what-are-differences-between-assemblyversion-assemblyfileversion-and-assemblyin – SteveC May 22 '14 at 09:48

2 Answers2

2

Annoyingly (however probably on purpose) the * in the assembly version attributes only works if applied to the last two, not just the final one:

[assembly: AssemblyVersion("3.1.*")]
// [assembly: AssemblyFileVersion("3.1.*")] - I take it back, this doesn't work.

If you want to increment the revision number without breaking .Net references then I suggest that you use the assembly file version rather than the assembly version, and increment the assembly version manually whenever you decide its necessary.

The only alternative would be a 3rd party add-in or external process.

(It seems that I was wrong - the * syntax only works on the assembly version not the file assembly version.)

Justin
  • 84,773
  • 49
  • 224
  • 367
  • I'll accept this as the answer, because commenting out the file version means it inherits the assemblyversion. – JL. Sep 08 '10 at 15:44
1

Looks like someone had the same issue, and the resolution is to comment out the 'AssemblyFileVersion' attribute, and it will take the value of the 'AssemblyVersion' which should work for you.

Assembly File Version not changing?
Assembly File Version not changing?

Community
  • 1
  • 1
atconway
  • 20,624
  • 30
  • 159
  • 229