Team City 6.5 Issue Using service message - TeamCityReportStatsValue to publish these values to TeamCity Server.

Hi,

I am new to TeamCity. I am setting up continuous integration process and running Code Metrics analysis step as part of this process. I am trying to calculate code metrics and display graphs (Customizing Statistics Charts) of this code metrics data over time.

In order to accomplish this task I have added a task in MSBuild to run Code Metrics analysis by running Metrics.exe. I have used the MSBuild community task XmlRead to extract the values from the xml output file generated by Metrices.exe and then the Team City task TeamCityReportStatsValue to publish these values to TeamCity Server.

However this step of publish these values to TeamCity Server is failing and the following is the error that is being logged:

[CodeMetrics] Unable to process service message: "[buildStatisticValue key='maintainabilityIndex' value='90;90;90;95;98;95;98;79;77']"

Following is the Code Metrics analysis Task from MSBuild.

  <Target Name="CodeMetrics" DependsOnTargets="Compile">

    <Exec Command='$(CodeMetricsTool) /plat:$(MSBuildToolsPath) /out:&quot;$(MSBuildProjectDirectory)\Reports\CodeMetricsReport.xml&quot;/f:&quot;$(MSBuildProjectDirectory)\CI_Demo\bin\Release\*.dll&quot;' />

    <XmlRead XPath="//*/Metric[@Name='MaintainabilityIndex']/@Value" XmlFileName="$(MSBuildProjectDirectory)\Reports\CodeMetricsReport.xml">

      <Output TaskParameter="Value" PropertyName="maintainabilityIndex" />

    </XmlRead>

    <TeamCityReportStatsValue Key="maintainabilityIndex" Value="$(maintainabilityIndex)" />

    

  </Target>

I would really appreciate any help resolving this issue.

Thanks.

1 comment
Comment actions Permalink

Hi Salman

TeamCity expects a single integer value, but your xpath query returns an array.
Chose one of the metric instancer you want to display, or publish them as separate keys with different names.

Michael

0

Please sign in to leave a comment.