我使用一个.runsettings文件来管理生成代码覆盖结果的程序集。
使用我的.runsettings文件中的以下部分,我得到了所有的程序集,包括我的测试项目,一些不需要的TFSBuildExtensions程序集:
<!-- Match assembly file paths: -->
<ModulePaths>
<Include />
<Exclude />
</ModulePaths>因此,我修改了它,以排除我的测试项目,这些项目都被命名为MyCompany.MyProject1.Tests.dll。
<!-- Match assembly file paths: -->
<ModulePaths>
<Include />
<Exclude>
<ModulePath>.*Tests.*</ModulePath>
</Exclude>
</ModulePaths>但是,现在所有我的程序集都被排除在外,我只剩下TFSBuildExtensions程序集。
应在“排除”部分中指定哪些内容以排除下列程序集?
发布于 2014-12-01 13:07:12
好的,我发现了问题所在:https://stackoverflow.com/a/15961727/283787
Regex正在寻找一个路径,而不仅仅是一个模块名,您需要模块前面的.*来忽略它--也就是说,您希望在任何给定的文件路径上忽略它。
所以当我把它改为跟随它时,效果很好:
<ModulePaths>
<Exclude>
<ModulePath>.*tests\.dll$</ModulePath>
<ModulePath>.*tfsbuildextensions\..*\.dll$</ModulePath>
</Exclude>
</ModulePaths>发布于 2014-11-25 11:27:56
这应该是你想做的事:
<!-- Match assembly file paths: -->
<ModulePaths>
<Include />
<Exclude>
<ModulePath>^.*Tests\.dll$</ModulePath>
<ModulePath>^tfsbuildextensions\..*\.dll$</ModulePath>
</Exclude>
</ModulePaths>https://stackoverflow.com/questions/27123978
复制相似问题