我的测试文件夹设置如下:
我已经从命令行自行运行了源监视器,它成功运行完成并输出了一些我的 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>
我收到以下错误:
研究链接:我正在关注的文章