我正在尝试使用VS 2017中的.runsettings文件运行带有测试的构建,我想要排除所有在其名称中都有'test'的.dll文件我查找了一些MSDN教程但我没有找到它们很有用。我试图做这样的事情。但它只是没有通过测试而不是实际排除它们
<exclude>
<objectSet>
<pattern type="File"> C:\* [test.dll] </pattern>
<pattern type="File"> C:\* [tests.dll] </pattern>
</objectSet>
</exclude>
答案 0 :(得分:1)
<!--
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的来源链接:Using Regular Expressions in Visual Studio
您可以使用下面的排除部分,使用.runsettings
从代码覆盖中排除程序集
<ModulePath>.*tests.dll</ModulePath>
<ModulePath>.*Tests.dll</ModulePath>
或者
<ModulePath>.*\.tests\..*</ModulePath>
<ModulePath>.*\.Tests\..*</ModulePath>
更多详情请参阅此类似问题:How to exclude Projects with names ending in ".Test" from my code coverage analysis in VS2012 Unit Tests