Introduction
AssemblyVersion
attributes of AssemblyInfo.cs files look something like these:
[assembly: System.Reflection.AssemblyVersion("1.0.0.0")]
[assembly: System.Reflection.AssemblyVersion("1.0.0.*")]
[assembly: System.Reflection.AssemblyVersion("1.0.*.*")]
The asterisks in the second and third examples will cause the compiler to set those two fields, but the values used may not be very useful. If you want useful values, you need to use the first example and set them yourself, but that can be a bit tedious.
This little program of mine will find an AssemblyVersion
attribute in the specified file (if one exists) and attempt to increment its fourth field by one. You will still need to set the other fields manually, but that's just the nature of the beast.
Using the code
Compile Versioner.cs with your choice of C# compiler.
To run it, use:
Versioner AssemblyInfo.cs
Such a command may be added to a Visual Studio project as a "Pre-build event", this will cause the version to be incremented automatically when the project gets built.
History
- First uploaded - 2006/06/09.