views:

51

answers:

3

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.

A: 

Check out this add-on for Visual Studio:

http://autobuildversion.codeplex.com/

Seems to be configurable, though not 100% sure it can do what you want.

Fosco
Tried that, doesn't work :( Actually its buggy, and doesn't allow you to set certain configuration values.
JL
+1  A: 

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.)

Kragen
I'll accept this as the answer, because commenting out the file version means it inherits the assemblyversion.
JL
+1  A: 

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?
http://stackoverflow.com/questions/1158252/assembly-file-version-not-changing

atconway