0

テストフォルダーは次のように設定されています。

ここに画像の説明を入力

コマンド ラインからソース モニターを単独で実行したところ、正常に実行され、CI プロセスに必要な .xml ファイルがいくつか出力されました。

以下は、実行しようとしている .proj ファイルです。

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Analyze" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
  <MSBuildCommunityTasksPath>.</MSBuildCommunityTasksPath>
</PropertyGroup>
  <Import Project="MSBuild.Community.Tasks.Targets"/>

  <Target Name="Analyze">  
    <Exec Command="sm.exe /C sm-commands.xml"/>

    <XmlRead XPath="//*/metric[@id='M0']" XmlFileName="sm-summary.xml">
      <Output TaskParameter="Value" PropertyName="NumberOfLines" />
    </XmlRead>
    <TeamCityReportStatsValue Key="NumberOfLines" Value="$(NumberOfLines)" />

    <XmlRead XPath="//*/metric[@id='M5']" XmlFileName="sm-summary.xml">
      <Output TaskParameter="Value" PropertyName="MethodsPerClass" />
    </XmlRead>
    <TeamCityReportStatsValue Key="MethodsPerClass" Value="$(MethodsPerClass)" />

    <XmlRead XPath="//*/metric[@id='M7']" XmlFileName="sm-summary.xml">
      <Output TaskParameter="Value" PropertyName="StatementsPerMethod" />
    </XmlRead>
    <TeamCityReportStatsValue Key="StatementsPerMethod" Value="$(StatementsPerMethod)" />

    <XmlRead XPath="//*/metric[@id='M10']" XmlFileName="sm-summary.xml">
      <Output TaskParameter="Value" PropertyName="MaxComplexity" />
    </XmlRead>
    <TeamCityReportStatsValue Key="MaxComplexity" Value="$(MaxComplexity)" />

    <XmlRead XPath="//*/metric[@id='M14']" XmlFileName="sm-summary.xml">
      <Output TaskParameter="Value" PropertyName="AvgComplexity" />
    </XmlRead>
    <TeamCityReportStatsValue Key="AvgComplexity" Value="$(AvgComplexity)" /> 

    </Target>
</Project>

次のエラーが表示されます。

ここに画像の説明を入力

研究リンク:私がフォローしている記事

4

1 に答える 1