views:

1014

answers:

3

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 ?

+6  A: 

In Visual Studio 2005 you cannot use 1.0.* to auto-increment the AssemblyFileVersion, only the AssemblyVersion. It's possibly the same in Visual Studio 2008.

Comment out the following line

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

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

Patrick McDonald
Works, im using vs2008 so it seems to have carried over.
maxp
Horrible situation, caught me out myself last year, fingers crossed for 2010!
Patrick McDonald
+2  A: 

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
Excellente, gave the answer tag to Patrick but would've given it twice if i could :D
maxp
A: 

We need to keep the assemble version the same, but increment the file version so the GAC will recognize when an update occurs. How do we get the best of both worlds?

Example (which doesn't work and generates a warning) AssemblyVersion 1.7.0.0 AssemblyFileVersion 1.7.*

What do we do then?

Dustin