23

I have in my assemblyinfo.cs class the code:

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

Calling System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString() works fine and gives the updated version, however, when i look at the generated dll in windows explorer, right click properties, click the 'details' tab, the fileversion says "1.0.0.0" even though the output above says 1.0.3489.17621 ?

starblue
  • 55,348
  • 14
  • 97
  • 151
maxp
  • 24,209
  • 39
  • 123
  • 201

2 Answers2

32

You cannot use 1.0.* to auto-increment the AssemblyFileVersion, only the AssemblyVersion. (Checked in all Visual Studio versions from 2005 to 2012).

Comment out the following line

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

and the File Version will take the same number as the Assembly Version.

Patrick McDonald
  • 64,141
  • 14
  • 108
  • 120
23

Patrick already gave the correct answer, but here is just a little advice. If you look into AssemblyInfo.cs you'll find the following block at the end:

// 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 Build and Revision Numbers 
// by using the '*' as shown below:
//[assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

Now go on and flip the comment from the last three lines as follows:

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

And everything works as expected... :-)

Oliver
  • 43,366
  • 8
  • 94
  • 151
  • 1
    Excellente, gave the answer tag to Patrick but would've given it twice if i could :D – maxp Jul 21 '09 at 11:09
  • Interesting that trying to blank out the AssemblyFileVersion in the GUI doesn't let you until you comment it out like this says. Thanks! – Brock Hensley Oct 01 '13 at 21:11