Error emitting ‘System.Reflection.AssemblyVersionAttribute’ attribute — ‘The version specified ’1.0.080928.1′ is invalid

 

You might have seen this error when using the Microsoft AssemblyInfo Task utility. The reason for this error is that the build number version info cannot be greater than 65535. And when using the default settings in the AssemblyInfo Task configuration file which is yyMMdd:

For a date info of 2008-09-28 the build version number would be 1.0.080928.x , and 80928 is greater than 65535, which would generate the error in question.

 

In order to fix this you will have to edit the Microsoft.VersionNumber.targets file which is located in the C:\Program Files (x86)\MSBuild\Microsoft\AssemblyInfoTask folder. Or C:\Program Files\MSBuild\Microsoft\AssemblyInfoTask on 32bit installations.

 

You will find the AssemblyBuildNumberFormat element in two places. Edit those to another format, for instance 01MMdd and save the file.

 

You will then have to reset the version in the AssemblyInfo.cs file(s) to v1.0.0.0, save the files, restart Visual Studio and rebuild the solution.