Daniel
Daniel

Reputation: 813

How to automate Assembly File Version in C#

Assembly version can be auto-incremented by specifying it as "1.0.*", which automatically determines build and revision number. But in case somebody wants their File version to be the same as the Assembly version, for consistency or other reasons, how can that be achieved without typing it by hand every time? The "1.0.*" method does not work for AssemblyFileVersion.

Upvotes: 2

Views: 2117

Answers (1)

Daniel
Daniel

Reputation: 813

In Properties/AssemblyInfo.cs, just comment out the last line

[assembly: AssemblyFileVersion("1.0.0.0")]

so the end of the file reads

// 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.*")]
//[assembly: AssemblyFileVersion("1.0.0.0")]

That way the Assembly version number will automatically be assigned as File version as well.

Upvotes: 9

Related Questions