xUnit dotCover msBuild 错误

xUnit dotCover msBuild error

我正在尝试创建一个 MSBuild 版本来输出一个 dotCover.html 报告以上传到 SonarQube。但是 - 即使所有单元测试都通过,dotCover 也会出错。我不知道从这里去哪里。

MsBuild 文件

  <ItemGroup>
    <TestAssemblies Include="**\bin\Release\*.tests.dll" />
  </ItemGroup>
  <PropertyGroup>
    <dlls>@(TestAssemblies, ' ')</dlls>
  </PropertyGroup>
  //Some other targets
  <Target Name="DotCover">
    <Exec Command='"%LOCALAPPDATA%\JetBrains\Installations\dotCover04\dotCover.exe" analyse /ReportType=HTML /Output="dotCover.html" /TargetWorkingDir=. /TargetExecutable:"packages\xunit.runner.console.2.1.0\tools\xunit.console.exe" /TargetArguments="$(dlls) -noshadow" /LogFile' />
  </Target>

dotCover 日志文件出错

15:17:29.682 |I| IteratorsProcessor | Can't find matching method for iterator class Xunit.Sdk.XunitTestAssemblyRunner+d__14 Extracted containing method name: RunTestCollectionsAsync Candidates number: 0 Parent type methods: .ctor; Dispose; GetTestFrameworkDisplayName; GetTestFrameworkEnvironment; SetupSyncContext; Initialize; AfterTestAssemblyStartingAsync; BeforeTestAssemblyFinishedAsync; RunTestCollectionsAsync; RunTestCollectionAsync; SetSynchronizationContext; <>n__0 15:17:29.703 |I| IteratorsProcessor | Can't find matching method for iterator class Xunit.Assert+d__56`1 Extracted containing method name: ThrowsAsync Candidates number: 0 Parent type methods: .ctor; Equals; ReferenceEquals; False; False; False; False; True; True; True; True; All; Collection; Contains; Contains; Contains; DoesNotContain; DoesNotContain; DoesNotContain; Empty; Equal; Equal; NotEmpty; NotEqual; NotEqual; Single; Single; Single; Single; GetComparer; GetEqualityComparer; Equal; Equal; Equal; Equal; StrictEqual; NotEqual; NotEqual; NotEqual; NotEqual; NotStrictEqual; Throws; Throws; Throws; ThrowsAsync; ThrowsAny; ThrowsAny; ThrowsAnyAsync; Throws; Throws; ThrowsAsync; Throws; ThrowsAny; Throws; Throws; Throws; ThrowsAsync; GuardArgumentNotNull; RecordException; RecordException; RecordException; RecordExceptionAsync; NotSame; Same; NotNull; Null; PropertyChanged; InRange; InRange; NotInRange; NotInRange; ProperSubset; ProperSuperset; Subset; Superset; Contains; Contains; DoesNotContain; DoesNotContain; StartsWith; StartsWith; EndsWith; EndsWith; Matches; Matches; DoesNotMatch; DoesNotMatch; Equal; Equal; IsLineEnding; IsWhiteSpace; SkipLineEnding; SkipWhitespace; IsAssignableFrom; IsAssignableFrom; IsNotType; IsNotType; IsType; IsType

非常感谢任何帮助。谢谢。

DotCover 无法在没有 PDB 可供使用的情况下针对程序集处理信息。您可以通过在用于构建的配置下添加 <DebugType>pdbonly</DebugType> 或将 /debug:pdbonly 开关添加到项目的编译器行来设置要使用的 PDB。您可以通过构建面板上的项目属性、高级选项部分或手动编辑 csproj.xml 来设置这些。如果 PDBs 不是最佳选择,您可以在 dotcover 之后将 post 条件设置为 运行 以清除它们。