4

是否可以从代码度量中排除类库或代码文件?我找不到很好的资源,因为它们似乎都专注于代码覆盖率,可以在 .runsettings 文件中设置。

我想在测试项目的代码行上构建一个没有警告的构建。

4

2 回答 2

5

显然,Files to ignore构建模板上有一个字段,我已经好几个月没有注意到了:

Code Metrics > Files to ignore.

这需要一个正则表达式,所以我可以说:

*.Tests.dll

这不包括我的测试库。

于 2015-03-20T07:52:32.310 回答
0

You have to separate your solution into two projects. One for your program, one for tests. Then you you just have to run code analysis on the program project. And remember that your tests have also to be clean

于 2015-03-20T07:48:51.783 回答