'Azure DevOps AssemblyInfo task errors with The specified version string does not conform to the required format - major[.minor[.build[.revision]]]
I'm trying to use the following Azure DevOps task in my build.
https://marketplace.visualstudio.com/items?itemName=bleddynrichards.Assembly-Info-Task
My task looks like this:
- task: Assembly-Info-NetCore@3
inputs:
Path: '$(Build.SourcesDirectory)'
FileNames: '**/*.csproj'
InsertAttributes: true
FileEncoding: 'auto'
WriteBOM: false
VersionNumber: '1.0.$(Build.BuildNumber)'
FileVersionNumber: '1.0.$(Build.BuildNumber)'
PackageVersion: '1.0.$(Build.BuildNumber)'
LogLevel: 'verbose'
FailOnWarning: false
DisableTelemetry: false
When the task runs, I see it works:
Assembly neutral language:
Assembly version: 1.0.20220223.2
Assembly file version: 1.0.20220223.2
Informational version:
When I tried to build the app, I get the following error:
AssemblyInfo.cs(15,59): warning CS7035: The specified version string does not conform to the recommended format - major.minor.build.revision...specific csproj
Solution 1:[1]
There is a hard limit on the max size of each component of the version number for assemblyversion(possibly AssemblyFileVersion too), UInt16.MaxValue/65535, and anything above that will cause a compile error.
This is detailed here -> https://docs.microsoft.com/en-us/dotnet/api/system.reflection.assemblyversionattribute?view=net-6.0 in the remark section.
I had a similar thing and had to rework the build number format to get it to work.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | newky2k |
