我试图在VS 2017中使用.runsettings文件运行一个带有测试的构建,并且我想排除所有以它们的名字包含“test”的.dll文件,我查阅了一些MSDN教程,但是我没有发现它们有用。我试着做这样的事。但它只是没有通过测试,而不是将它们排除在外。
<exclude>
<objectSet>
<pattern type="File"> C:\* [test.dll] </pattern>
<pattern type="File"> C:\* [tests.dll] </pattern>
</objectSet>
</exclude>发布于 2017-05-23 02:18:01
<!--
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中使用正则表达式
可以在使用.runsettings时使用下面的排除部分将程序集排除在代码覆盖范围之外。
<ModulePath>.*tests.dll</ModulePath>
<ModulePath>.*Tests.dll</ModulePath>或者这个
<ModulePath>.*\.tests\..*</ModulePath>
<ModulePath>.*\.Tests\..*</ModulePath>更多详情请参阅以下类似问题:如何从我在.Test单元测试中的代码覆盖率分析中排除以“VS2012”结尾的项目
发布于 2021-10-06 14:55:20
下面一个在.runSettings文件中为我工作。
<ModulePaths>
<Exclude>
<ModulePath>.*tests\.dll$</ModulePath>
<ModulePath>.*test\.dll$</ModulePath>
</Exclude>
</ModulePaths>https://stackoverflow.com/questions/44073888
复制相似问题