Search code examples
c#.netmsbuildassemblyfileversion

CS1607: Assembly generation -- The version '1.4.0.85725' specified for the 'file version' is not in the normal 'major.minor.build.revision' format


(Please excuse me if I get any terms mixed up here - I am a Java developer, new to .Net and C#. Please add/correct any tags on this question if need be.)

I am using an MSBuild script to build my project. One of the tasks is to write the assembly info:

<Target Name="UpdateAssemblyInfo">
    <Message Text="Updating assemblies to file version $(AssemblyVersion) ($(AssemblyFileVersion))" Importance="high"/>
    <AssemblyInfo CodeLanguage="CS"
                  OutputFile="SharedAssemblyInfo.cs" 
                  AssemblyVersion="$(AssemblyVersion)"
                  AssemblyFileVersion="$(AssemblyFileVersion)"
                  AssemblyProduct="SVN revision $(BUILD_NUMBER)"/>
</Target>

This converts SharedAssemblyInfo.cs from this:

[assembly: System.Reflection.AssemblyVersion("0.0.0")]

To this:

//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//     Runtime Version:4.0.30319.18063
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

[assembly: System.Reflection.AssemblyVersion("1.4.0")]
[assembly: System.Reflection.AssemblyFileVersion("1.4.0.85725")]
[assembly: System.Reflection.AssemblyProduct("SVN revision 85725")]

So far so good. Except I see the following message in the build log of TeamCity:

CSC warning CS1607: Assembly generation -- The version '1.4.0.85725' specified for the 'file version' is not in the normal 'major.minor.build.revision' format

Why am I getting this warning, when the format of the version appears to follow the format specified in the warning message?


Solution

  • The reason why you are getting the error is because the revision number is greater than 65534.