Reputation: 329
I'm getting this build error on Jenkins. I'd appreciate any help hunting down a solution for it, or even someone to point me in the right direction.
This is the error I'm getting:
"D:\Jenkins\jobs*REDACTED*\workspace\CAPS.msbuild" (default target) (1) -> (Compile target) -> error MSB4018: The "AssemblyInfo" task failed unexpectedly. System.ArgumentException: version Parameter name: The specified string is not a valid version number at Microsoft.Build.Extras.Version.ParseVersion(String version) at Microsoft.Build.Extras.AssemblyInfo.Execute() at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() at Microsoft.Build.BackEnd.TaskBuilder.d__20.MoveNext()
I've verified that the AssemblyInfo.cs files all look good (as far as I can tell) and nothing seems out of sorts with the msbuild file for the solution.
I've Googled all the derivations of the error that I can think of.
Any advice would be appreciated.
Comment Responses:
From the AssemblyInfo.cs file:
[assembly: AssemblyVersion("2.0.*")]
From the msbuild file:
<PropertyGroup>
<ProjectName>CAPS</ProjectName>
<Configuration Condition=" '$(Configuration)' == '' ">Release</Configuration>
<VersionLabel Condition=" '$(VersionLabel)' == '' ">0.0</VersionLabel>
<AssemblyVersion>2.0.$(VersionLabel)</AssemblyVersion>
</PropertyGroup>
This may also be relevant:
<Target Name="Compile">
<ItemGroup>
<UpdateFiles Include="**\AssemblyInfo.cs" Exclude="**\.svn\**" />
</ItemGroup>
<AssemblyInfo AssemblyInfoFiles="@(UpdateFiles)" AssemblyVersion="$(AssemblyVersion)" AssemblyFileVersion="$(AssemblyVersion)"/>
<MSBuild Projects="$(ProjectName).sln" Properties="Configuration=$(Configuration);RunCodeAnalysis=true" />
</Target>
Upvotes: 3
Views: 3338
Reputation: 6681
Its a bug in the task, if you change the [assembly: AssemblyVersion("2.0.*")] in your assembly info to a version no [assembly: AssemblyVersion("2.0.0.0")] it'll work.
Upvotes: 1
Reputation: 13239
My guess would be that your use of the VersionLabel variable is not resolving, and it is trying to write the literal 2.0.$(VersionLabel) into the AssemblyInfo file.
One side note: You are setting AssemblyVersion and AssemblyFileVersion to the same number, in a strong named situation you will not be able to hot swap Dll's. Usually AssemblyVersion would be '2.0' and your AssemblyFileVersion would be '2.0.13345.02' or whatever your numbering scheme is. That way a dll built in 2 weeks which would have '2.0' and say '2.0.13352.01' could be swapped in and still work.
If you are publishing the whole package everytime this may not be important, but your are not using the fields correctly.
See this answer from another question
Upvotes: 4