$TAG$ produces 'the version specified '0.tip.606.1' is invalid

Mar 28, 2011 at 6:07 AM

Hi there,

first of all I want to say thank you! This is a really nice way to combine mercurial versioning and Visual Studio versioning, nice work!

For me using $TAG$ doesn't seem to work though. I am guessing strings are not allowed in version numbers, but since it is in the tokens list I was wondering how you got it working...

Thanks in advance,

Lars

Coordinator
May 2, 2011 at 12:19 PM

Hi!

Yes, the components of a .NET assembly version are 16-bit numbers, so you can't use strings.

Try adding an AssemblyInformationalVersion attribute. The value for this attribute is free text, and it shows up in the properties of your assembly as the "product version".

[assembly: AssemblyVersion("1.0.$REVNUM$.$DIRTY$")]
[assembly: AssemblyInformationalVersion("1.0.$REVNUM$.$DIRTY$ $TAGS$")]

Also, there's nothing restricting you from using tokens in other files. For example, create a BuildInfo class, and set it up the same way with a BuildInfo.base.cs file and something like this:

 

    public static class BuildInfo
    {
        public static string TagNames
        {
            get { return "$TAGS$"; }
        }
    }

Of course, that doesn't make the tags show up in the properties of your assembly, but you could display the information in your program's About dialog, etc.