I’m building a .NET 4 application in Visual Studio 2012 and wish to version my .net Assembly in the format.
[assembly: AssemblyInformationalVersion("6.0.1")]
[assembly: AssemblyVersion("6.0.*.0")]
However I get an error when I build of:
Properties\AssemblyInfo.cs(40,12): error CS0647: Error emitting 'System.Reflection.AssemblyVersionAttribute' attribute -- 'The version specified '6.0.*.0' is invalid'
Is this even possible? I noticed that in some Microsoft DLL’s their versioning was in line with this.
Each of the version parts has to be in the range 0 – 65535.
One way to have a dynamic version string is to declare a public const string in another class (say the VersionClass class) and use that as the version string argument to AssemblyVersion. Then write a script (using say powershell) to recreate VersionClass with any dynamic value of the version string. Run this script as a pre-build event and the VersionClass gets overwritten on every compile.
Update:
Here is a tool that simplifies setting the version: http://autobuildversion.codeplex.com/
I haven’t tried it but it looks like this will handle the scenario you want.