.runsettings - 排除所有带有'test'的文件



我正在尝试使用 VS 2017 中的 .runsettings 文件运行带有测试的构建,我想排除所有名称中包含"test"的.dll文件我查找了一些 MSDN 教程,但我发现它们没有用。我试图做这样的事情。但它只是没有通过测试,而不是实际排除它们

<exclude>
<objectSet>
<pattern type="File"> C:* [test.dll] </pattern>
<pattern type="File"> C:* [tests.dll] </pattern>
</objectSet>
</exclude>
<!--
About include/exclude lists:
Empty "Include" clauses imply all; empty "Exclude" clauses imply none.
Each element in the list is a regular expression (ECMAScript syntax).
An item must first match at least one entry in the include list to be included.
Included items must then not match any entries in the exclude list to remain included.
-->

来自 MSDN 的源链接:在 Visual Studio 中使用正则表达式

您可以使用下面的排除部分,并使用.runsettings从代码覆盖率中排除程序集

<ModulePath>.*tests.dll</ModulePath>
<ModulePath>.*Tests.dll</ModulePath>

或者这个

<ModulePath>.*.tests..*</ModulePath>
<ModulePath>.*.Tests..*</ModulePath>

更多详细信息请参阅以下类似问题:如何排除名称以".测试"来自VS2012单元测试中的代码覆盖率分析

下面是一个在 .runSettings 文件中为我工作。

<ModulePaths>
  <Exclude>
    <ModulePath>.*tests.dll$</ModulePath>
    <ModulePath>.*test.dll$</ModulePath>
  </Exclude>
 </ModulePaths>

相关内容

最新更新