Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The specified version string does not conform to the required format - major[.minor[.build[.revision]]]

I want to append our application version with the build number. For example, 1.3.0.201606071.

When setting this in the AssemblyInfo, I get the following compilation error:

Error CS7034 The specified version string does not conform to the required format - major[.minor[.build[.revision]]]

Assembly info:

[assembly:System.Reflection.AssemblyFileVersionAttribute("1.0.0.201606071")]
[assembly:System.Reflection.AssemblyVersionAttribute("1.0.0.201606071")]
[assembly:System.Reflection.AssemblyInformationalVersionAttribute("1.0.0.201606071")]

Why would this be happening?

like image 578
Dave New Avatar asked Jun 21 '16 09:06

Dave New


3 Answers

The maximum value for either of the parts is 65534, as you read here. This is a limit imposed by the operating system, so not even specific to .NET. Windows puts the version numbers into two integers, which together form four unsigned shorts.

Adding some metadata to it (for the * option I guess) makes the maximum allowed value UInt16.MaxValue - 1 = 65534 (Thanks to Gary Walker for noticing):

All components of the version must be integers greater than or equal to 0. Metadata restricts the major, minor, build, and revision components for an assembly to a maximum value of UInt16.MaxValue - 1. If a component exceeds this value, a compilation error occurs.

Your 201606071 exceeds this limit.

like image 196
Patrick Hofman Avatar answered Oct 18 '22 20:10

Patrick Hofman


If you are targeting netcoreapp2.0 and don't have AssemblyInfo.cs at all you can fix

error CS7034: The specified version string does not conform to the required format

by adding this into your .csproj file:

<PropertyGroup>
  <GenerateAssemblyInfo>False</GenerateAssemblyInfo>
  <Deterministic>False</Deterministic>
</PropertyGroup>
like image 26
Dmitry Pavlov Avatar answered Oct 18 '22 19:10

Dmitry Pavlov


It's because each number in the version is a ushort! That's a pity.

like image 13
Dave New Avatar answered Oct 18 '22 20:10

Dave New