Luc Millette Luc Millette - 27 days ago 8
C# Question

Invalid value for 'AssemblyVersion' when building valid csproj

I have a project which references a few other projects. They are all built using x86 as the platform. This compiles just fine on my desktop.

During my remote VSO build I am always getting the error


MSB3174: Invalid value for 'AssemblyVersion'


When I edit the
.csproj
file, I see nothing wrong with it. What am I doing wrong?

VSO build arguments are simply:
/t:Publish /p:ApplicationVersion=$(Build.BuildNumber)

I have other projects that use $(Build.BuildNumber) with no problems

Arguments as seen on VSO build log (snipped for clarity):

"C:\Program Files (x86)\MSBuild\12.0\bin\msbuild.exe" "[App_PATH].csproj"
/nologo
/nr:false
/t:"Clean"
/dl:CentralLogger,[*snip dll path]
/t:Publish
/p:ApplicationVersion=DEPLOY.[App_Name]_2016.11.09.16
/p:platform="x86"
/p:configuration="DV1"
/p:_MSDeployUserAgent="VSTS[*snip]"


EDIT: I tried running the MSBuild from a local command prompt and I get the same behavior. VSTS or any of its setup info is not to blame.

I just wish I knew were to look in my app to correct it.

Answer

The issue is here:

/p:ApplicationVersion=DEPLOY.[App_Name]_2016.11.09.16 

The version format does not meet the requirement. Please try with this format: 1.2.3.4.

Refer to MSBuild Error MSB3174 and Version Constructor (String) for details.

Remarks

The version parameter can contain only the components major, minor, build, and revision, in that order, and all separated by periods. There must be at least two components, and at most four. The first two components are assumed to be major and minor. The value of unspecified components is undefined. The format of the version number is as follows. Optional components are shown in square brackets ('[' and ']'): major.minor[.build[.revision]] All defined components must be integers greater than or equal to 0. For example, if the major number is 6, the minor number is 2, the build number is 1, and the revision number is 3, then version should be "6.2.1.3".